|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: paul rivers (rivers.paul
gmail.com)
Date: Mon Mar 31 2008 - 23:57:47 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
>
> But I can execute the sql statement of "select uin,count(*) as dd from
> active_users where date >= date_add(curdate(),interval -30 day) group by
> uin" successfully.
>
> How to fixup it? thanks!
>
>
> Get the name you always wanted with the new y7mail email address.
> www.yahoo7.com.au/y7mail
>
>
>
>
>
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.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]