mysql - how to return data if catgory have at least three families -
i have 2 tables relationship..every category have family or more
1-product_category
2-family
i want select categories , families joined if category have @ least 3 families in family table
i try doesn't work..something wrong count()
select count(fa_name) count, d_family.*, d_product_type_category.pt_name d_family inner join d_product_type_category on d_family.fa_id = d_product_type_category.pt_id (count > 2)
try this. aggregated column must filtered having clause not clause
select count(fa_name) count, d_family.*, d_product_type_category.pt_name d_family inner join d_product_type_category on d_family.fa_id = d_product_type_category.pt_id group <add non-aggregated columns in select clause> having (count > 2)
Comments
Post a Comment