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

    DISTINCT keyword is supposed to be applied to all the columns in the select query and not just to the column next to which DISTINCT keyword is written. So, basically, it means that every row returned in …

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

    Feb 19, 2017 · Then at the end you put the distinct column to filter and you only group it with that last distinct column. This will bring you the maximum ID with the correspondent data, you can use min or …

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

    Sep 10, 2008 · I want to select the distinct values from one column 'GrondOfLucht' but they should be sorted in the order as given in the column 'sortering'. I cannot get the distinct values of just one …

  4. Using DISTINCT along with GROUP BY in SQL Server

    Is there any purpose for using both DISTINCT and GROUP BY in SQL? Below is a sample code SELECT DISTINCT Actors FROM MovieDetails GROUP BY Actors Does anyone know of any …

  5. Using the distinct function in SQL - Stack Overflow

    3 I have a SQL query I am running. What I was wanting to know is that is there a way of selecting the rows in a table where the value in on one of those columns is distinct? When I use the distinct …

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

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

    Apr 5, 2019 · SELECT COUNT(DISTINCT column_name) AS some_alias FROM table_name This will count only the distinct values for that column.

  8. 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) TOP 10 * …

  9. sql - How to use DISTINCT and ORDER BY in same SELECT statement ...

    282 The problem is that the columns used in the ORDER BY aren't specified in the DISTINCT. To do this, you need to use an aggregate function to sort on, and use a GROUP BY to make the DISTINCT …

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

    May 25, 2011 · You have selected the distinct column in the subquery but the where clause gets all those columns with that value. So the query is as good as writing 'select * from table' unless 'field' …