Re: help with a sql statement

2008-03-31 Thread paul rivers
tech user wrote: Add an alias for the subquery select * from ( select ) my_alias where dd >= 3; Better, use a having clause and eliminate the subquery. Odds are it will be more efficient in MySQL. How to replace the original one with a having statement? Thanks again. sele

Re: help with a sql statement

2008-03-31 Thread tech user
> > Add an alias for the subquery > > select * from ( select ) my_alias where dd >= 3; > > Better, use a having clause and eliminate the subquery. Odds are it > will be more efficient in MySQL. > How to replace the original one with a having statement? Thanks again. Get the n

Re: help with a sql statement

2008-03-31 Thread paul rivers
tech user wrote: hello, I try to execute this sql in mysql shell,but got error as: mysql> select * from (select uin,count(*) as dd from active_users where date >= date_add(curdate(),interval -30 day) group by uin) where dd >=3; ERROR 1248 (42000): Every derived table must have its own alias