About 432,000 results
Open links in new tab
  1. How to select unique records by SQL - Stack Overflow

    DISTINCT works to select a distinct combination of all the columns you selected. In this case, the combination "item1,data1" and "item1,data2" are two completely different combinations of the …

  2. How do I (or can I) SELECT DISTINCT on multiple columns?

    Sep 10, 2008 · The problem with your query is that when using a GROUP BY clause (which you essentially do by using distinct) you can only use columns that you group by or aggregate …

  3. MySQL: Select DISTINCT / UNIQUE, but return all columns?

    May 25, 2011 · SELECT DISTINCT FIELD1, FIELD2, FIELD3 FROM TABLE1 works if the values of all three columns are unique in the table. If, for example, you have multiple identical values …

  4. sql - DISTINCT e GROUP BY, qual a diferença entre ambas as …

    Aug 11, 2017 · DISTINCT A instrução SELECT DISTINCT é usada para retornar apenas valores distintos (diferentes). Dentro de uma tabela, uma coluna geralmente contém muitos valores …

  5. sql - Using DISTINCT and TOP in the same query - Stack Overflow

    I want to use DISTINCT and TOP in the same query. I tried SELECT DISTINCT TOP 10 * FROM TableA but I still have a duplicate personID, so I tought to do: SELECT DISTINCT (personID) …

  6. sql - How to use DISTINCT and ORDER BY in same SELECT …

    SELECT Category i.e. remove the extended sort key column again from the result. So, thanks to the SQL standard extended sort key column feature, it is totally possible to order by something …

  7. sql - How to select only the first rows for each unique value of a ...

    In the table, one customer like John Smith can have multiple addresses. I need the SELECT query for this table to return only first row found where there are duplicates in 'CName'. For …

  8. How to Select Every Row Where Column Value is NOT Distinct

    I need to run a select statement that returns all rows where the value of a column is not distinct (e.g. EmailAddress). For example, if the table looks like below: CustomerName EmailAddress A...

  9. sql - DISTINCT for only one column - Stack Overflow

    Feb 19, 2017 · SELECT DISTINCT TOP 1 ID, Email, ProductName, ProductModel FROM Products ORDER BY ID DESC The TOP 1 will return only the first record, by ordering it by the …

  10. sql - DISTINCT clause with WHERE - Stack Overflow

    How can I use the DISTINCT clause with WHERE? For example: SELECT * FROM table WHERE DISTINCT email; -- email is a column name I want to select all columns from a table with …