0
order of producing result when distinct is used
when we use distinct like select distinct column_name from table_name how the order it produces result c1 p1 10 1-Sep-16 c2 p3 20 18-Mar-17 c5 p5 30 20-Dec-16 c3 p2 45 1-Sep-16 c4 p4 15 1-Sep-16 c7 p3 22 18-Mar-17 c1 p2 23 1-Sep-16 c2 p1 33 -Jul-17 mean when searching from top of table does p1 0f c1 will be in result or p1 of c2 will be in result
6 Respostas
+ 1
p1 will be in the result only once, it does not matter based on which line, because the other columns are not shown.
You can select distinct column1, column2
Then all unique combinations of the two columns are retrieved.
+ 1
If you use distinct on multiple columns, then the result will be grouped by all those columns.
Anyway you can control the order of the result lines with ORDER BY clause.
I could probably give a more helpful answer if you formulate your question more precisely :)
+ 1
lucky no. You can only use distinct immediately after the select keyword.
0
Here other columns are print
But if there is a situation of printing all then which will be print
0
Ok bro tq
- 1
Just like SELECT * from class_name where DISTINCT column_name