|
-
Jun 18th, 2004, 10:20 AM
#1
Thread Starter
Frenzied Member
SQL Gurus again
Trying to write an join for ADO.NET and ODBC.
I need to outer join three tables and do an In on the first table, is this possible to do in one statement?
I basically want to combine these two statements:
SELECT BI_ACCT, BI_SRV_STAT_CD, BI_DNP_SW FROM BI_TYPE_SERVICE WHERE BI_SRV_STAT_CD IN(1,3,7,18,19,21,22,25,26,29,30,42,45)
SELECT t.BI_ACCT, t.BI_SRV_STAT_CD, t.BI_DNP_SW, a.BI_VWN_TOT_AR, c.BI_OUTAGE_PRI_CD, c.BI_MED_NEC_CD, c.CC_NBR, c.BI_SRV_LOC_NBR FROM (BI_TYPE_SERVICE t LEFT JOIN BI_AR_TOTALS_VIEW_1 a ON t.BI_ACCT = a.BI_ACCT) LEFT JOIN BI_CONSUMER c ON t.BI_ACCT = c.BI_ACCT
Will the following give me the data I need? I mean it "works", but I'm not positive I'm getting the correct dataset.
SELECT t.BI_ACCT, t.BI_SRV_STAT_CD, t.BI_DNP_SW, a.BI_VWN_TOT_AR, c.BI_OUTAGE_PRI_CD, c.BI_MED_NEC_CD, c.CC_NBR, c.BI_SRV_LOC_NBR FROM (BI_TYPE_SERVICE t LEFT JOIN BI_AR_TOTALS_VIEW_1 a ON t.BI_ACCT = a.BI_ACCT) LEFT JOIN BI_CONSUMER c ON t.BI_ACCT = c.BI_ACCT WHERE t.BI_SRV_STAT_CD IN(1,3,7,18,19,21,22,25,26,29,30,42,45)
thanks for any help...
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|