About 792,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 two …

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

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

  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. t sql - Select distinct from another select results - Stack Overflow

    Mar 31, 2017 · I want to select distinct results from another select statement results e.g; select distinct from (select * from table) following is result of inner select testing department 9998901036 ...

  6. 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 this table it should …

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

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

    SELECT DISTINCT TOP 2 name FROM [ATTENDANCE] ; In the above query, name is the column_name and [ATTENDANCE] is the table_name. You can also use WHERE with this to make …

  9. 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 for first …

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