mysql union query
Posted
by
Sergio
on Stack Overflow
See other posts from Stack Overflow
or by Sergio
Published on 2011-01-07T11:51:18Z
Indexed on
2011/01/07
11:53 UTC
Read the original article
Hit count: 305
The table that contains information about members has a structure like:
id | fname | pic | status
--------------------------------------------------
1 | john | a.jpg | 1
2 | mike | b.jpg | 1
3 | any | c.jpg | 1
4 | jacky | d.jpg | 1
Table for list of friends looks like:
myid | date | user
-------------------------------
1 | 01-01-2011 | 4
2 | 04-01-2011 | 3
I want to make a query that will as result print users from "friendlist" table that contains photos and names of that users from "members" table of both, myid (those who adding) and user (those who are added).
That table in this example will look like:
myid | myidname | myidpic | user | username | userpic | status
-----------------------------------------------------------------------------------
1 | john | a.jpg | 4 | jacky | d.jpg | 1
2 | mike | b.jpg | 3 | any | c.jpg | 1
© Stack Overflow or respective owner