Questions tagged as 'sql'

4
answers

How to do advanced data filtering across multiple fields? [closed]

I have a table from which I need to get results varying by certain user data: I need to return the rows where each column or hit with its user parameter or is blank (null). Consider as user parameters the bottom of the image - USER_ID =...
asked by 08.01.2015 / 20:04
2
answers

SQL Select return only one of several

I have two tables. "User" table that has 5 rows and 5 users. andthe"lease" table that has 20 records, using 5 foreign key ID of the user table WhenIusethisselectIdidselectu.nomefromusuarioujoinlocacaolonl.UsuarioId=u.idItreturnsmethef...
asked by 11.10.2018 / 10:02
3
answers

Help with SQL query with COUNT in multiple lines

Hello, I'm doing the following query SELECT p.id, c.nome, v.titulo, count(v.titulo) FROM passageiros AS p LEFT JOIN clientes AS c ON c.id = p.id_cliente LEFT JOIN viagens AS v ON v.id = p.id_viagem GROUP BY v.titulo; And it is returning...
asked by 09.12.2018 / 04:37
1
answer

Group By SQL Server Function [closed]

I'm new to SQL Server , I'd like some help to understand the Group By function in a simple way. Both its concept and how to use ... for anyone who can help me thank you right away!     
asked by 12.12.2018 / 18:54
1
answer

pdo UPDATE does not work

I'm trying to send some values to SQL, but the PDO does not work as it should, or I'm forgetting something, I'm new to using PDO. Functional code example. $conn = new PDO('mysql:dbname=config_database;host=127.0.0.1', 'root', ''); $...
asked by 11.06.2014 / 21:24
3
answers

Help with SubQuery in SQL?

I have in my system a table called Agendas, this table is linked to other Class and School tables through columns turmas_id and escola_id . What happens is that the turmas_id column is not a related foreign key even if it rec...
asked by 01.03.2016 / 13:41
1
answer

What are the differences between sql commands?

What's the difference, when should I use the following sql commands and which expressions can accompany these commands? order by ,group by, join e union What is the use and when should I use the commands below in a select? 1) where nomeda...
asked by 30.09.2014 / 12:02
2
answers

How to make this SQL request with this particularity?

In this search when the array returns 4 as shown in the SQL below, I need the system to return all results whose number of rooms and >= 4 . You can help me get this result. I converted the column to INT . It was ugly the...
asked by 07.10.2014 / 20:36
1
answer

MySql query - How to select products that were returned before being purchased using sql only

I have the following table of a mysql product movement database that contains the following fields: id | prod_id | prod_name | movimento_tipo | data_transaction 1 | idProd1 | tv | ordemCompra | 1-jan-2018 2 | idProd1 | tv |...
asked by 22.11.2018 / 16:52
2
answers

SQL Updating Wrong Value

I'm creating a QUERY to change every day of the dates recorded in the DB for the last day of the month of that record ... what happens is that when I play QUERY by selecting a record in month 5 (May) it updates the value of the day with 30 ......
asked by 03.08.2018 / 16:22