Subject Re: [firebird-support] Performance troubles
Author Martijn Tonies
Hi,

> I'm working on a java application and are facing some serious
> 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

Would this give you the same result?

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