MySql PHP组合选择查询1

时间:2015-02-09 10:15:58

标签: php mysql

查询1

SELECT * FROM `student_1` WHERE location like '%php%'

查询2

SELECT * FROM `student_4` WHERE keyskill like '%php%'

我想将这两个表合并为一个代码和结果

2 个答案:

答案 0 :(得分:0)

使用UNION

SELECT * FROM student_1 WHERE location like '%php%'
UNION
SELECT * FROM student_4 WHERE keyskill like '%php%'

只要两个表中的列匹配

答案 1 :(得分:0)

尝试这样的事情

SELECT  (
    SELECT *
    FROM student_1
    ) where condition,
    (
    SELECT *
    FROM student_4
    ) where condition
)