> so now I can create the statement > select distict product_id, count_bool(purchased, true), > count_bool(was_selected, true) from some_table group by product_id; > > instead of breaking the query into 3 seperate queries > > select distict product_id from some_table; > select count(purchased) from product_id where purchased = true; > select count(was_selected) from some_table where was_selected = true; > Am I missing a detail with SQL based aggregate function development? > Any help would be appreciated.
how about: select product_id, ( select count(purchased) from some_table as A2 where purchased=true and A1.product_id=A2.product_id ) as TP, ( select count(selected) from some_table as A3 where purchased=true and A1.product_id=A3.product_id ) as TS from some_table as A1 group by product_id; Regards, Richard Broersma Jr. ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings