Re: SQL optimisation, stop the sub query as soon as an error is found
- From: "TheSQLGuru" <kgboles@xxxxxxxxxxxxx>
- Date: Fri, 13 Nov 2009 11:08:18 -0600
Thanks for the feedback. Glad I could help! :-)
--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"obiron via SQLMonster.com" <u56148@uwe> wrote in message
news:9f0bd3df5e4b1@xxxxxx
Damn, that took less than 2 seconds - you really are a guru...
Thanks a lot.
I was doing it the other way because it was originally written with a CTE
rather than a TT
Aaron
TheSQLGuru wrote:
It would really help if you gave table script and sample data with
expected
outcome, but here is a stab:
select *
from #pathway p1
where main_code = 90
and not exists (select * from #pathway p2 where p1.keyfield? =
p2.keyfield?
and p2.main_code = 30 and p2.rank < p1.rank)
that should be MUCH more efficient than your triple hit on the table)
Hi guys,[quoted text clipped - 71 lines]
Development environment is SQL2005
--
Message posted via http://www.sqlmonster.com
.
- References:
- SQL optimisation, stop the sub query as soon as an error is found
- From: obiron
- Re: SQL optimisation, stop the sub query as soon as an error is found
- From: TheSQLGuru
- Re: SQL optimisation, stop the sub query as soon as an error is found
- From: obiron via SQLMonster.com
- SQL optimisation, stop the sub query as soon as an error is found
- Prev by Date: Re: Validation Duplicate
- Next by Date: Re: Quicked way to create a copy of a table with all default values in
- Previous by thread: Re: SQL optimisation, stop the sub query as soon as an error is found
- Next by thread: SQL optimisation, stop the sub query as soon as an error is found
- Index(es):
Relevant Pages
|