我想在一个语句中执行这些查询: - 如何?
SELECT count(id) as levela FROM `member` where parent_id in (SELECT id FROM `member` where parent_id in (SELECT id FROM `member` where parent_id = 2 ))
SELECT count(id) as levelb FROM `member` where parent_id in (SELECT id FROM `member` where parent_id = 2)
SELECT count(id) as levelb FROM `member` where parent_id = 2
答案 0 :(得分:0)
使用'where','where in' - where in允许你在数组中搜索。 例如:
Select id from member where parent_id IN (here array ($y) )
答案 1 :(得分:0)
我认为你可以使用这个
SELECT id FROM member where parent_id IN (x, y, z)
如果遇到困难,你可以使用这样的子查询:
SELECT id FROM member where parent_id IN (SELECT id FROM list_parent_id WHERE "condition you want to find" )
希望这个帮助=)