Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Help script
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kabon
Starting Member

Indonesia
48 Posts

Posted - 03/27/2013 :  03:06:50  Show Profile  Reply with Quote
can i use script select where in and not in together?
for example :

SELECT REPLACE(B.[Column 0] COLLATE Latin1_General_100_BIN2 ,LEFT(B.[Column 0],CHARINDEX('.',B.[Column 0])-1),isnull(C.T24_ID,LEFT(B.[Column 0],CHARINDEX('.',B.[Column 0])-1)))
from LDTLTXT_20130314 as B
LEFT JOIN F_CUSTOMER_ALT_CUST_ID C ON LEFT(B.[Column 0],CHARINDEX('.',B.[Column 0])-1) COLLATE Latin1_General_100_BIN2 =C.LEGACY_ID
WHERE REPLACE(B.[Column 0] COLLATE Latin1_General_100_BIN2 ,LEFT(B.[Column 0],CHARINDEX('.',B.[Column 0])-1),isnull(C.T24_ID,LEFT(B.[Column 0],CHARINDEX('.',B.[Column 0])-1))) COLLATE Latin1_General_100_BIN2 in
(SELECT LEFT(REPLACE(HIST.RECID,LEFT(HIST.RECID,CHARINDEX('.',HIST.RECID)-1),isnull(D.T24_ID,LEFT(HIST.RECID,CHARINDEX('.',HIST.RECID)-1))),19)
FROM t24testsby.dbo.FBNK_LIMIT#HIS AS HIST WITH(NOLOCK)
LEFT JOIN F_CUSTOMER_ALT_CUST_ID D ON LEFT(HIST.RECID,CHARINDEX('.',HIST.RECID)-1)=D.LEGACY_ID
WHERE LEFT(REPLACE(HIST.RECID,LEFT(HIST.RECID,CHARINDEX('.',HIST.RECID)-1),isnull(D.T24_ID,LEFT(HIST.RECID,CHARINDEX('.',HIST.RECID)-1))),19) NOT IN
(SELECT RECID FROM t24testsby.dbo.FBNK_LIMIT WITH (NOLOCK))
)

I've tried but i don't know why doesn't finish

bandi
Flowing Fount of Yak Knowledge

India
2241 Posts

Posted - 03/27/2013 :  04:52:59  Show Profile  Reply with Quote
what is the problem with above query?
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000