+ 1
Select distinct name, email from USER;
what should this command return ??.... is this possible to get distinct elements from both name and email tables of only from one .
4 Answers
+ 5
Do you mean the distinct values of name, and then (separately) the distinct values of email? If so, you could two queries:
select distinct name from users;
and
select distinct email from users;
You could also join these results:
select distinct 'resultset1' as a, name as b
from users
union
select distinct 'resultset2' as a, email as b
from users;
I've added the constant strings 'resultset1' and 'resultset2' just for tracking purposes.
+ 3
Oh Ok... "distinct" with a list of fields will return the distinct *combinations*. For example, two records that hold (each of them) name="n1" and email="e1" will be shown as one record in your result set.
+ 1
I am also asking the same question ~~... if I am putting DISTINCT before two column name separated by " , " then what it will retrieve ....????.... as mentioned above ...
+ 1
okk thanks...