Link to home
Get AccessLog in
Avatar of andieje
andieje

asked on

How to get a union query to return distinct rows

Hi

Is there a way to get a union query to only return a distinct set of rows if there is overlap in the rows returned by the multiple select statements?

thanks
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of andieje
andieje

ASKER

thanks
check these

(select 1 union select 2)
1
2

(select 1 union select 3 union select 1 union select 2)
1
2
3

(select 1 union select 2)
union
(select 1 union select 3 union select 1 union select 2)
1
2
3