多表查询_子查询

-- 多表查询 单行单列		
SELECT * FROM yg WHERE bm = (SELECT id from bm WHERE id = 1);
-- 多表查询 多行单列
SELECT * FROM yg WHERE bm in (SELECT id from bm WHERE id = 1 or id = 2);

SELECT * from yg where rq > (SELECT rq from yg WHERE rq = '1979-07-11');

-- 多行多列
SELECT * from (SELECT * from yg WHERE rq > '1979-07-11') t1 , bm  WHERE t1.bm = bm.id;

您可能还喜欢...