SELECT DISTINCT field1, field2, field3, ...... FROM table
I am trying to accomplish the following sql statement but I want it to return all columns is this possible? Something like:
SELECT DISTINCT field1, * from table
SELECT DISTINCT field1, field2, field3, ...... FROM table
I am trying to accomplish the following sql statement but I want it to return all columns is this possible? Something like:
SELECT DISTINCT field1, * from table
I would suggest using
this way if you have the same value in field1 across multiple rows, all the records will be returned.
Just include all of your fields in the GROUP BY clause.
It can be done by inner query
You can do it with a
WITH
clause.For example:
This also allows you to select only the rows selected in the
WITH
clauses query.