About 154,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. 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 - Should I use distinct in my queries - Stack Overflow

    Nov 11, 2015 · A distinct function checks each individual selection criteria vs a group by which does the same thing only done as a whole. Keep in mind I only do reporting . I do not create/alter the data. So …

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

    16 It works simply if you use query like this: 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 …

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

  6. SQL Query Multiple Columns Using Distinct on One Column Only

    I am trying to write a SQL query that selects multiple columns from a table with the distinct operator on one column only. The table is simple. The columns are: tblFruit_ID, tblFruit_FruitType,

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

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

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

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