Most voted "distinct" questions
21 questions
Sort by count of
- 
		4 votes1 answer1365 viewsCountdown in two tablesI’m having trouble counting items pertaining to neighborhoods. I need to list all the neighborhoods of the city X and show the items available cars and motorcycles. In the example I only used one… 
- 
		4 votes1 answer1453 viewsDoubt in the method of using Distinct and Count together!I have a requested table as the example below: Id | Cliente | Status 1 | XPTO | Proposta 2 | ABCD | Proposta 3 | XPTO | Venceu 4 | XPTO | Perdeu And I want to present a result like this: Cliente |… 
- 
		4 votes1 answer784 viewsSelect the first row of each group in MysqlSuppose I have such a table: item | group -------+-------- item a | group x item b | group y item c | group y item d | group x item e | group z And that I want to select a single item to represent… 
- 
		2 votes1 answer3058 viewsSQL distinct with sumHello, I have a problem making a sum in a query. Example and query results: select DISTINCT t.ID, t.nomeuc as "Nome UC", t.tipoturno as "Tipo Turno", a.num_presencas as "Número de Presenças" from… 
- 
		2 votes0 answers54 viewsmysql if - how to apply to equal recordsHello! staff I am trying to select and apply a rule only in equal records. I need all records to be listed, but in those that are equal, a specific rule is applied; For example, select all client… 
- 
		2 votes2 answers127 viewsSearch last access record with MYSQLSuppose I have the table clientes: -------------------------------------- | ID| Cliente | Data_Registro | |------------------------------------- | 7 | Joaquim | 2019-07-17 09:45:00 |… 
- 
		1 votes1 answer327 viewsSelect Distincttbl_protocolos id_protocolo | protocolo | assunto 1;ra001;vazamentos 2;ra002;incendios 3;ra003;inundacoes tbl_prot_tramitacoes id_tram | id_protocolo | pdf | id_setor_origem 1;1;001.pdf;70… 
- 
		1 votes2 answers389 viewsMD5 is good enough?I’m working on a legacy system, which has a database with about five years of accumulated records with no normalization. Among other things, its purpose is to allow users to write and post posts in… 
- 
		1 votes1 answer703 viewsSearch last record of a distinct groupI’m developing a small vaccine control system and I’m having a hard time executing a select. I have a record of dogs, other types of vaccines and a third of dog vaccine, where I group the dog’s id,… 
- 
		1 votes1 answer225 viewsselect distinct in temporal table sql serverI have the following code: (is from a table that the representatives have the same code, which generates duplicated values, I solve this by taking the most current representative, in short the last… 
- 
		0 votes1 answer440 viewsSelect Union same tableCould anyone help me with this problem? The query below throws the following error: #1054 - Unknown column 'u.idocorrencia' in 'Where clause' SELECT DISTINCT * FROM( (SELECT o.*, u.nome AS… 
- 
		0 votes1 answer688 viewsUse DISTINCT SQL Server clauseHi, I need some help ! I need to do a query and bring in the Nifs without repeating. I do it like this: SELECT DISTINCT NIF FROM CustomerRegistrations But I also want to bring more columns from this… 
- 
		0 votes1 answer100 views
- 
		0 votes1 answer82 viewsselect return results without repeating replyI have the following query SELECT (SUM(DISTINCT result)/COUNT(*))as total, uf FROM users WHERE result > 0 and result IS NOT NULL GROUP BY uf ORDER BY total DESC LIMIT 5 I want to select all 5… 
- 
		0 votes2 answers719 viewsBring repeat records from 3 columns in the same tableI have a table with transport voucher data of 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… 
- 
		0 votes1 answer668 viewsMysql - Sort before groupingI need to make a selection that brings the last users who logged in, without repeating the names. The problem is that the command below first groups and then sorts: SELECT usuario FROM tab_logins… 
- 
		0 votes1 answer330 viewsConsolidate all columns into one MYSQL rowI’m trying to make a query that groups all the results in one line, that is, that does not bring duplicated results. I’ve used the distinct and the group bybut one of the two has returned what I… 
- 
		0 votes2 answers517 viewsSelection top 3 Where distinctGood afternoon, you guys. https://stackoverflow.com/questions/1925176/sql-server-2008-top-10-and-distinct-together I need a help, I tried to see in the above section but could not solve my problem.… 
- 
		0 votes2 answers408 viewsHow to use distinct to bring a single result of each Dart/Flutter itemHello, I am trying to bring a single result of each consuming title from an API. As this picture shows I’m having repeated titles What way could I make it right, it follows code as far as I’ve tried… 
- 
		0 votes3 answers721 viewsSelect Distinct is bringing duplicate Mysql dataI need to bring only the last record of each id_face that has in the table imagens, but for some reason it’s bringing id_faces duplicates. Follow my consultation: SELECT DISTINCT(i.id_face) as… 
- 
		0 votes1 answer32 viewsDISTINCT in a WHERE OracleI need to return the last two purchases of each table item NOTA_FISCAL_ENTRADA_ITEM, but returns column values VL_UNITARIO_ENTRADA_EST different. That is, if in the last two purchases the value is…