Questions tagged as 'group-by'

2
answers

SQL Group same ID with another condition

I believe this is a somewhat specific question, because I do not find anything related yet. I have a table named contas_produtos , which is a NxN relation between the contas and the produtos tables. The table has the...
asked by 14.02.2017 / 14:46
1
answer

Select with group by double

In MySQL I have a table named contact_status : id | id_contato | detalhamento_id 1 | 1 | 2 2 | 1 | 3 3 | 2 | 4 4 | 2 | 2 5 | 2 | 1 6 | 3 | 2 7 |...
asked by 10.07.2018 / 14:58
1
answer

Group By show when not in table

I have the following table in MySQL: I wanted to search for users who have the color BLUE but do not have the GREEN color, ie, this table would list me the user 3 only, I tried this way: SELECT * FROM usuario_cor WHERE tipo = 'azul' A...
asked by 03.12.2018 / 17:23
1
answer

Help with Query in Linq C #

I have a message table in the following scheme: Id | osID |Interessado | Remetente | Destinatario | Msg -------------------------------------------------- 1 | 2 |João | João | Maria |bla bla bla... 2 | 2 |João...
asked by 30.10.2018 / 17:51
1
answer

Compare two tables in mysql by grouping the main table and listing the result of the second table

Hello! I will explain from the beginning .. I am comparing the following tables accounts with clientes  select uses user_id to find all clients with same users_id2 in table clientes as described below, right th...
asked by 16.08.2018 / 09:06
1
answer

MySQL SELECT with ORDER BY in GROUP BY

I have a table called contacts , where all contacts made on the site are registered. There is also a table named status , where the service status of each contact is stored. In doubt, I need to SELECT contacts, and in LEFT JOIN only show...
asked by 13.06.2018 / 13:31
1
answer

I'm having some problems with GROUP BY

I'm having a hard time putting together a select with GROUP BY . What I want to do is this: I have three tables: bicos idbico, idempresa, idbomba abastecimentos idabastec, idbico, idempresa, valora...
asked by 18.05.2018 / 21:20
1
answer

Arrange mysql select by groups of the month

I'm trying to organize a return of my mysql database in months, that is, so that I have groups of the months of donations that the site that I work receives, I tried: SELECT * , MONTH( 'DataConfirmacao' ) FROM 'doacoes' WHERE Pendente = '1'...
asked by 05.05.2018 / 18:21
2
answers

SQL subqueries with counter

I have a table like this: ++++++++++++++++++++++++++++++++++++++++ + Nome | Cargo | Estado + + ++++++++++++++++++++++++++++++++++++++ + Joao | Estagiário | RJ + + Maria | Analista | RJ + + Thiago| Ge...
asked by 24.03.2018 / 18:11
2
answers

Bring repeated records of 3 columns in the same table

I have a table with transport data from my company employees: nome ! valor1 ! valor2 ! valor3 teste1 ! 6.50 ! 0.00 ! 0.00 teste2 ! 4.30 ! 2.80 ! 1.10 teste3 ! 8.40 ! 1.10 ! 0.00 teste4 ! 2.85 ! 1.10 ! 0.00 Where it is possible for the empl...
asked by 16.01.2018 / 19:43