Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-09-28 : 10:05:30
|
| Kee writes "Hello,I'm having problems with the used of "EXISTS" I try to do my code using OR instead of AND, the output result is slow.Here is my code:SELECT distinct p.product_idFROM product p, org o, product_membership pm, product_event_dates pedWHERE p.product_id *= pm.product_idand p.org_id = o.org_idand p.product_id *= ped.product_idand o.state = 'WA'AND (exists (SELECT (1) FROM product_activities pal WHERE pal.activity = 'Adventure' AND p.product_id = pal.product_id) OR exists (SELECT (1) FROM product_tariff_season_tact ptst WHERE ptst.activity = 'Adventure' AND p.product_id = ptst.product_id))AND p.product_id < 5000 Once I remove the code: OR exists (SELECT (1) FROM product_tariff_season_tact ptstWHERE ptst.activity = 'Adventure'AND p.product_id = ptst.product_id) it seen to excute faster. How can I improve this code so that the query time can be faster. Cheers Kee" |
|
|
|
|
|