Search Postgresql Archives

Re: A join of 2 tables with sum(column) > 30

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mar 16, 2011, at 3:03 AM, Alexander Farber wrote:

> # select u.id, u.first_name, sum(m.completed)
> from pref_users u, pref_match m
> where u.id=m.id and u.id like 'DE%' and
> sum > 30 group by u.id, u.first_name
> order by sum desc limit 3;
> 
> ERROR:  column "sum" does not exist
> LINE 4: ...f_match m where u.id=m.id and u.id like 'DE%' and sum > 30 g...
> 
> Any suggestions please? I've tried "... sum(m.completed) as total" too..


Try following:
select u.id, u.first_name, sum(m.completed) from pref_users u, pref_match m where u.id=m.id and u.id like 'DE%' and sum(m.completed > 30 group by u.id, u.first_name order by sum desc limit 3; 

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@xxxxxxxxxxxxxxxx
Blog:http://vibhork.blogspot.com


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux