Mysql (二) 复杂查询

  https://www.cnblogs.com/Soprano/p/10659101.html

https://www.jianshu.com/p/c9b95e35999e

https://www.cnblogs.com/sugartang/p/10967435.html

1子查询 先查询 tb_content 表中category_id 最小的,然后在查询与 parent_id想等=或者包含IN的tb_content_category表的信息

SELECT  * FROM `tb_content_category` tb2  WHERE tb2.parent_id=(SELECT min(tb1.category_id)FROM `tb_content` tb1);

SELECT  * FROM `tb_content_category` tb2  WHERE tb2.parent_id IN (SELECT min(tb1.category_id)FROM `tb_content` tb1);

 

 

2 子查询

posted @ 2020-03-05 14:33  ThisCall  阅读(186)  评论(0编辑  收藏  举报