Questions tagged as 'mysql'

1
answer

Mysql query problem with empty column

I have a Query where I give a select with INNER JOIN between two tables (contacts and company) I have a field called business_id where I search the business table to find the business name, but the business_id field is not required, so you...
asked by 29.11.2017 / 13:39
1
answer

Error getting the bank's value

I'm trying to get the ID of a bank data with PHP. At the time of returning the value, it always comes as 1. //Obtenho os valores por GET $description = $_GET['DESC']; $contentType = $_GET['TYPE']; $content = $_GET['CONT']; //Crio meu objeto d...
asked by 29.08.2017 / 17:28
1
answer

Add variables to columns (MySQL)

I have a question, is it possible to add variables in a column? Test Code var sql = "INSERT INTO sometable (someparam) VALUES (varToParam)"; con.query(sql, function (err, result) { if (err) throw err; console.log("test"); });...
asked by 31.08.2017 / 20:16
1
answer

Hibernate does not find mysql JDBC driver class in Maven project

Hello everyone, I created a maven project in eclipse (with WAR packaging) and I imported the packages of models already mapped from another project, I then created a class to "load" a factory of persistence but it returns the following error:...
asked by 19.09.2017 / 15:18
2
answers

Search in two tables [duplicate]

I have a media table with the fields id_midia , nome , tipo , and another synonymous table that has the id_midia , sinônimo I need to make a query where it checks the two tables whether the term you typed is co...
asked by 20.09.2017 / 14:23
1
answer

How to give a select and play values in the same column

Example: select 'a' as 'letras', 'b' as 'letras' I want to play the letter 'a' and the letter 'b' in the column 'letters', but with this code it returns 2 columns with the same name, but I want to play the values in the same column and I do...
asked by 29.03.2018 / 02:18
2
answers

MySQL using variables in select

I have tried a few tutorials but I do not think there is any expectation on how to declare the variable in select by MySQL, DECLARE @idPedido INT; DECLARE @idCombo INT; SELECT @idPedido = idPedido, @idCombo = idCombo FROM Pedidos WHERE idC...
asked by 08.11.2017 / 19:01
2
answers

I need to list the quantity of an 'X' product that each customer bought

Below is the structure and relationships of my database. I tried to use the code: 'SELECT 'cliente'.'Nome', 'produto'.'Descricao', 'contem'.'QuantItem' FROM 'cliente', 'produto', 'contem' INNER JOIN 'pedido' ON 'cliente'.'Codigo' =...
asked by 12.09.2017 / 20:52
1
answer

Variable to stay round and spoil calculation

I have the following SELECT: SET @peso := 0; SET @ganho := 0; SELECT @peso := (SELECT SUM(peso)/1000 FROM entrada WHERE entrada_id = A.entrada_id)+@ganho AS peso, @peso, @ganho := (SELECT SUM(ganho)/1000 FROM entrada WHERE entrada...
asked by 29.09.2017 / 19:21
1
answer

Insert only filled data from the PHP array

I have a table, and I looped for it to receive input and also to do insert, however I'm having problems in INSERT and UPDATE . Where I have two codigo_tipo , descricao fields that are always inserted together int...
asked by 30.09.2017 / 15:30