2017-03-05 63 views
-2

究竟是什么statment正确的语法选择计数:如何使用在

select * 
from notices 
where count(select * from notices where no_type = 'p' 
     or no_type = 'n') > 3 
+1

你的目标究竟是什么?那个查询没有什么意义 – GurV

+0

什么语法? –

+0

也许你打算在子查询中从no_type ='p'或no_type ='n''的通知中选择count(*)。 – GurV

回答

0

这不是编写一个查询的最佳方式,但如果你真的需要它,这可能工作

select * from notices as a 
where (select count(*) from notices as b where no_type = 'p' 
    a.someColumn = b.someColumn) > 3 or (select count(*) from notices as c where 
    or no_type = 'n' and a.someColumn = c.someColumn) > 3