您的位置:首页 > 产品设计 > UI/UE

MySQL_Table_Sub_Query

2016-05-05 00:00 477 查看
摘要: In -- Compare > < ... -- Exists -- Any -- All

1. In

select * from t_book tb where tb.bookTypeId in (select id from t_bookType tbt);
select * from t_book tb where tb.bookTypeId not in (select id from t_bookType tbt);






2. Compare > < ...

select * from t_book tb where tb.price>=(select price from t_pricelevel where priceLevel=1);




3. Exists

select * from t_book where exists (select * from t_bookType);
select * from t_book where not exists (select * from t_bookType);




4. Any

select * from t_book where price >= any (select price from t_pricelevel);




5. All

select * from t_book where price >= all (select price from t_pricelevel);


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: