如何使这个子查询成为好看的代码?我正在寻找有关 SQL 优化和代码风格的指南。
SELECT foo FROM table WHERE foo_id IN
(
SELECT idchild FROM table2 WHERE idparent IN
(SELECT idchild FROM table2 WHERE idparent IN
(SELECT idchild FROM table2 WHERE idparent = @id)
))
AND txt_type ='some_cat'