Questions tagged as 'sql-select'

1
answer

Select with subquery

I have the following select: SELECT id_usuario, SUM(CASE p.tp_honorario WHEN 'Mensal' THEN (h.vl_honorario * 12) ELSE h.vl_honorario END) as valor FROM empresa_honorario as h INNER JOIN honorario as p ON p.id_honorario = h.id_honorario WHERE...
asked by 07.12.2016 / 12:14
1
answer

How to do a SQL query (MySQL) with average and several INNER tables?

I have an SQL statement with 5 tables. Notice that in it I make up a radius calculation. I need to add a new table of ratings with: cod_avaliacao int (11) customer_code cod_provider decimal_value evaluation (10,0) Where the avaliac...
asked by 03.05.2017 / 22:01
2
answers

How to group results from a row-to-column query

Good afternoon, I have this query SELECT tblcliente.idCliente, tblclienterespostapre.resposta FROM tblcliente INNER JOIN tblclienterespostapre ON tblclienteresp...
asked by 28.10.2015 / 16:18
2
answers

SELECT sort by quantity of another SELECT

I have two tables in MYSQL: account: id apelido_usuario 1 caio 2 manoel 3 josé product idconta status 1 3 1 3 1 1 2 3 3 2 I made a SELECT like this: SELECT * FROM conta WHERE apelido_usuar...
asked by 21.09.2015 / 20:00
1
answer

Bank table does not update

I have some tables in my database that already contain saved data, but I can not update this data. I have the method below that performs the insertion of a new item in the table if the table does not have the item, if it has the data that is...
asked by 11.06.2014 / 22:48
3
answers

Filter table before applying a LEFT JOIN

I have two tables and I want all elements of the first one - regardless of the JOIN condition (which characterizes a LEFT JOIN) - but before that I want to filter the second table. For example: Client table: ╔══════════╦═══════╗ ║ C...
asked by 19.02.2014 / 20:48
1
answer

Select to count amount per column

How do I make a select that returns the number of repeating devices, and the first and last date of these records? Equipamento | Data | Causa | B 01/01/2017 x B 03/04/2017 Y A 05/0...
asked by 10.01.2018 / 11:31
1
answer

phpMailer is not getting the values from my database

I'm trying to recover email and password, where: $o_email = $_GET['email']; $celular = $_GET['celular']; Receives via email the user's email or mobile phone. But I'm not getting this recovered data to play in phpMailer. What can I be doi...
asked by 25.07.2017 / 19:46
1
answer

Select a row where a column has an element of a CSV

I have a table in the database with the following structure: +---------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+---------+------+-----+---------+--------------...
asked by 15.03.2017 / 18:35
1
answer

How to convert search result in mysql into columns

Good evening guys, I do not know if anyone has gone through this, but I need to convert the result of a mysql search into columns, not to change the rows through the columns, but to make some results become the titles of column. Being: NOME...
asked by 14.06.2016 / 23:25