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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query rewrite

Author  Topic 

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-09-29 : 13:23:08
Hi all,

How would I rewrite this query to yield all routings that end in '1' ?

Thanks all!

select top 100 * from dbsrvr2.queues.dbo.OUTqueue2 a (nolock) where result=206 and routing in (
select routing from defineroutings where aggregator in (
select distinct mtnets from defineservice where servicetypeid in (5,6,9,10) and mtnets in
(select aggregator from defineaggregators where country='za')
))

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2010-09-29 : 13:59:18
DDL and sample data please

Terry

-- You can't be late until you show up.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-09-29 : 14:16:01
Why Nolock? Is inaccurate data acceptable?
See - [url]http://sqlblog.com/blogs/andrew_kelly/archive/2009/04/10/how-dirty-are-your-reads.aspx[/url]

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -