
28 Jan
2009
28 Jan
'09
7:21 p.m.
On Wed, Jan 28, 2009 at 11:47 AM, dariuszs
Hi, If I rewrite this query like this
select * from (select gender,count(*) from table1 group by gender) as t1 where t1.gender in ('F','M');
It takes about 2 seconds which is wonderful however how do I apply this to very complicated queries? Thanks. Dariusz.
I might suggest that it will be cleaner to do it this way. select gender, count(*) from table1 group by gender having gender in ('F','M'); (In the past, I've found that the construct "select ... from (select ....)" ends up creating SQL that's really hard to debug. YMMV.)