例1:查询某个文章及其对应的评论(单个详情) ) FROM A; 例2:查询分类表中,每种分类各包含多少商品(汇总) SELECT category_id, (SELECT count(goods_id) FROM Goods WHERE category_id = A.category_id) FROM category; 部分参考:http://zhidao.baidu.com/link?url=FAZU7UHkC-qZXm4rPm5SNzHtVPf_YzINFsM-sNIeVSXungAt…
参考mysql5.7 en manual,对列id的解释: The SELECT identifier. This is the sequential number of the SELECT within the query. The value can be NULL if the row refers to the union result of other rows. In this case, the table column shows a value like <unionM,N>…