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
 General SQL Server Forums
 New to SQL Server Programming
 optimising a query

Author  Topic 

msrs

32 Posts

Posted - 2007-09-04 : 07:21:13
hi all,

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-09-04 : 07:31:06
[code]UPDATE x
SET x.PendingAtGlobus = '2'
FROM tblCancelPolicy AS x
WHERE x.PendingAtGlobus = '1'
AND NOT EXISTS (SELECT * FROM tblSubscription AS e WHERE e.GlobusStatus IS NULL AND e.Wings_Status = 'S' AND e.Policy_id = x.Policy_id)


UPDATE x
SET x.PendingAtGlobus = '2'
FROM tblCancelPolicy AS x
LEFT JOIN tblSubscription AS e ON e.Policy_id = x.Policy_id
AND e.GlobusStatus IS NULL
AND e.Wings_Status = 'S'
WHERE x.PendingAtGlobus = '1'
AND e.Policy_id IS NULL[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2008-01-09 : 03:55:32
mmm....... another one.


Duane.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-09 : 05:29:26
Or he realized SQL is not his cup of tee and decided to leave the business?


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -