About 51 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 two …

  2. 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 ID descending …

  3. 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 functions.

  4. sql server - SELECT DISTINCT on one column - Stack Overflow

    1 FOO-23 Orange 3 FOO-24 Apple This query isn't getting me there. How can I SELECT DISTINCT on just one column?

  5. 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 distinct …

  6. 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 …

  7. sql - Selecting COUNT (*) with DISTINCT - Stack Overflow

    SELECT program_type AS [Type], Count(DISTINCT program_name) AS [Count], FROM cm_production WHERE push_number = @push_number GROUP BY program_type DISTINCT COUNT(*) will return …

  8. sql - select distinct a.* from table query - Stack Overflow

    Jul 15, 2013 · select distinct a.* from tbl_applicant a When would this code work? If it did work on some tables, it is masking proper results? What should be used instead?

  9. sql - Counting DISTINCT over multiple columns - Stack Overflow

    Sep 24, 2009 · SELECT COUNT(*) FROM (SELECT DISTINCT DocumentId, DocumentSessionId FROM DocumentOutputItems) AS internalQuery I need to count the number of distinct items from …

  10. SQL to find the number of distinct values in a column

    Apr 5, 2019 · You can use the DISTINCT keyword within the COUNT aggregate function: SELECT COUNT(DISTINCT column_name) AS some_alias FROM table_name This will count only the …