Re: Picking the better query (join vs subselect)

2008-08-08 Thread walter harms
Waynn Lue wrote: > Out of curiosity, is it generally faster to do a sub query or do it in > code for something like this. > > Schema of Settings table, where the PK is (ApplicationId, SettingId): > ApplicationId, SettingId, SettingValue > > Select SettingValue from Settings where SettingId = 10

Re: Picking the better query (join vs subselect)

2008-08-06 Thread Waynn Lue
Out of curiosity, is it generally faster to do a sub query or do it in code for something like this. Schema of Settings table, where the PK is (ApplicationId, SettingId): ApplicationId, SettingId, SettingValue Select SettingValue from Settings where SettingId = 10 and ApplicationId IN (select App

Re: Picking the better query (join vs subselect)

2008-08-06 Thread Rob Wultsch
On Wed, Aug 6, 2008 at 5:18 AM, Morten Primdahl <[EMAIL PROTECTED]> wrote: > I've tried to find out if joins are preferred over subselects, but am not > able to come to a definite conclusion. I read that correlated subselects are > bad, and I should go for the join, but I know the id of the record

Picking the better query (join vs subselect)

2008-08-06 Thread Morten Primdahl
Hi guys, I have 2 tables "cars" and "parts" where car has many parts. I need a query to return some fields from the cars table as well as a field from multiple parts records. I've come to the following approaches, and would like to understand which is the better, and why, or if there's a