Subject | Re: [firebird-support] Performance troubles |
---|---|
Author | Martijn Tonies |
Post date | 2005-10-27T09:44:11Z |
Hi,
select c.contactno, sum(g.giftvalue)
from contacts c join gifts g on (g.contactno = c.contactno)
where c.state in (1, 2) and
g.someotherfield = 'somvalue'
group by c.CONTACTNO
having sum(g.giftvalue) > 100
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
> I'm working on a java application and are facing some seriousWould this give you the same result?
> perfomance trouble.
> Details:
> The application (working thru jdbc) makes a simple join like this
>
> select contactno from contacts c
> where
> state in (1,2)
> and
> (select sum(giftvalue) from gifts g where g.contactno = c.contactno
> and someotherfield = 'somvalue') >= 100
select c.contactno, sum(g.giftvalue)
from contacts c join gifts g on (g.contactno = c.contactno)
where c.state in (1, 2) and
g.someotherfield = 'somvalue'
group by c.CONTACTNO
having sum(g.giftvalue) > 100
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com