问题
can i use select statements for different tables in a single query
SELECT *
FROM users
WHERE first_name LIKE "%'.$search_string.'%"
OR last_name LIKE "%'.$search_string.'%"
thats from the table ' users' , i want to do the same search on another table called sellers. sellers have the same fields first_name, last_name
回答1:
Yes, you can
Select column1,column2,column3,column4
From table1,table 2
Where Conditions
If you want to do join between tables, check if theirs PK and FK are equals Eg:
Select table1Id,table2Id,column3,column4
From table1 t1,table2 t2
Where t1=t2
来源:https://stackoverflow.com/questions/19754965/multiple-select-statements-for-mysql-search-query