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 2000 Forums
 SQL Server Development (2000)
 SQL Help, Outer Join

Author  Topic 

jrockfl
Posting Yak Master

223 Posts

Posted - 2004-07-18 : 08:33:50
This query returns all the rows from ARSLMFIL_SQL, how can I return the rows that are NOT IN ('web', '114') ?

SELECT A.Slspsn_No, A.Slspsn_Name, B.callsout, C.callsin
FROM ARSLMFIL_SQL A LEFT OUTER JOIN
(SELECT COUNT(calllog.TTID) AS callsout, TTExt
FROM calllog
WHERE calllog.TTDirection = 2
GROUP BY TTExt) B ON A.Slspsn_No = B.TTExt LEFT OUTER JOIN
(SELECT COUNT(calllog.TTID) AS callsin, TTAgtRngLst
FROM calllog
WHERE calllog.TTDirection = 1
GROUP BY TTAgtRngLst) C ON A.Slspsn_No = C.TTAgtRngLst

Kristen
Test

22859 Posts

Posted - 2004-07-18 : 08:59:37
You didn't say which column, but if its in ARSLMFIL_SQL then just add
WHERE MyColumn NOT IN ('web', '114')
to the bottom
Go to Top of Page

jrockfl
Posting Yak Master

223 Posts

Posted - 2004-07-18 : 09:34:57
Thank you! it worked. It just looked kinda funny to me, because it is coming after a GROUP BY. I guess that last GROUP BY is in the C subquery so it will affect the entire query.

How long have you been doing this stuff for?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-18 : 10:15:46
quote:
Originally posted by jrockfl
How long have you been doing this stuff for?


SELECT CONVERT(varchar(20), DATEDIFF(Year, DATEADD(Day, 0, 28489), GetDate())) + ' years ' + CONVERT(varchar(20), DATEDIFF(Month, DATEADD(Year, DATEDIFF(Year, DATEADD(Day, 0, 28489), GetDate()), DATEADD(Day, 0, 28489)), GetDate())) + ' months ' + CONVERT(varchar(20), DATEDIFF(Day, DATEADD(Month, DATEDIFF(Month, DATEADD(Year, DATEDIFF(Year, DATEADD(Day, 0, 28489), GetDate()), DATEADD(Day, 0, 28489)), GetDate()), DATEADD(Year, DATEDIFF(Year, DATEADD(Day, 0, 28489), GetDate()), DATEADD(Day, 0, 28489))), GetDate())) + ' days'

Go to Top of Page

jrockfl
Posting Yak Master

223 Posts

Posted - 2004-07-18 : 10:25:46
wow! thats very impressive! Thank you for all your help.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-18 : 10:33:19
my pleasure
Go to Top of Page
   

- Advertisement -