MySQL select post and comment count relative to comment count -


i'm trying select posts comment count

select id,title ,(select count(*) ci_comments (post_id = p.id)) comment_count ci_posts p type='post' , active=1 order comment_count desc , date_modified desc limit 6 

this works

but need filter comment_count > 10 :

select id,title ,(select count(*) ci_comments (post_id = p.id)) comment_count ci_posts p type='post' , active=1 , comment_count > 10  order comment_count desc , date_modified desc limit 6 

result : unknown column 'comment_count' in 'where clause'

so solution ?

try having .. having evaul result of query

select id,title ,(select count(*) ci_comments (post_id = p.id)) comment_count ci_posts p type='post' , active=1 having comment_count >10 order comment_count desc , date_modified desc limit 6 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -