Is it possible to get data from two exactly the same tables and print them? Currently I am able to search in TABLE1 but not in TABLE2 as well.
EDITTED
$name= $_SESSION['NAME'];
USER
ID - NAME
1 - AAAA
2 - BBBB
3 - CCCC
4 - DDDD
5 - EEEE
TABLE1
ID - CODE - BUYSELL
1 -A - Buying
2 - A - Buying
3 - B Buying
4 - B - Selling
5 - C - Selling
"SELECT * from TABLE1, TABLE2, USER WHERE '$person' = USER.NAME
AND TABLE1.ID = USER.ID";
TABLE2
ID - CODE - YESNO - CAR
1 - A - YES - VOLVO
2 - B - YES - FORD
3 - C - YES - M
4 - D - NO - BMW
5 - A - NO - VOLVO
(AND TABLE2.ID = USER.ID?????)
I want all to search both tables 1 and 2? But adding TABLE2.ID = USER.ID is basically looking for the same values in both tables. So if I wanted CODEs for USERID 1 from table1 and 2.
Is it possible under 1 query or 2?
Use
UNIONto combine the results of two queries into one: