Reputation: 1125
How does distinct work with the following table:
id | id2 | time
-------------------
1 | 5555 | 12
2 | 5555 | 12
3 | 5555 | 33
4 | 9999 | 44
5 | 9999 | 44
6 | 5555 | 33
select distinct * from table
Upvotes: 1
Views: 1538
Reputation: 81960
Select Distinct ID2 From SomeTable
Will return 5555 9999
Upvotes: 1
Reputation: 133370
If you use select distinct * from table
all the row are distinct
if you use
select distinct id2 , time from table
then you obtain
id2 | time
5555 | 12
5555 | 33
9999 | 44
With distinct you obtain the distinct rows based on the result of the select
Upvotes: 3
Reputation: 311308
Each row here is different, so distinct
will have no visible effect, and all the rows will be returned.
Upvotes: 1