5
如何在select子句中使用Post in子句(如SQL Server)在Post子句中进行Postgresql子查询?
我正在尝试在postgresql上编写以下查询: select name, author_id, count(1), (select count(1) from names as n2 where n2.id = n1.id and t2.author_id = t1.author_id ) from names as n1 group by name, author_id 这当然可以在Microsoft SQL Server上使用,但在postegresql上则根本不可用。我读了一点文档,似乎可以将其重写为: select name, author_id, count(1), total from names as n1, (select count(1) as total from names as n2 where n2.id …