Link to home
Start Free TrialLog in
Avatar of Gurbirs
GurbirsFlag for India

asked on

Select Data From Two Tables And show distinct records and second table records come first then first table record and having relationship.

Suppose i have table name tblfavuser(Contains data of favorite user)    and tbluser(contains the user data). I  want to show distinct record from both table and tblfavuser comes first then tbluser.
Avatar of Muhammad Noman Iqbal
Muhammad Noman Iqbal
Flag of Pakistan image

Hi,

You can use Union

Select  fav_user.id, favuser.name from fav_user
union
Select user.id, user.name from user

Avatar of awking00
Can you post some sample data and the expected results?
ASKER CERTIFIED SOLUTION
Avatar of MarkusId
MarkusId
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial