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.
Author |
Topic |
HarrySqlserver
Starting Member
1 Post |
Posted - 2007-11-18 : 17:08:42
|
I have following question for you. If you are unable to provide me with an answer... could you please tell me the keywords/search string I would need to use in order to Google this issue?Table_1_Debits:Dnum DbCrInd Abbreviation ---- ------- ------------ 8261 DB SALES8261 DB INTER8261 DB INTER8261 DB AR0414 DB AR3662 DB AR3662 DB ARTable_2_Credits:Dnum DbCrInd Abbreviation ---- ------- ------------ 8261 CR SALES8261 CR SALES8261 CR AR8261 CR INTER0414 CR SALES3662 CR SALES3662 CR SALESFrom the above two tables, I am looking for a query that will return Dnum only ONCE if the following condition exists:(DB=AR AND CR=SALES) AND (DB<>COS OR CR<>INV) AND (DB<>INTER OR CR<>INTER)Please note: In Table_1_Debits and Table_2_Credits, we have DB=INTER and also CR=INTER for Dnum 8261. Therefore, the query should not return any rows for Dnum 8261. However, for Dnum 0414 and 3662 the query should return rows or the value of Dnum.I have tried everything I know. I guess the problem is I do not know how to perform cross comparisons within each Dnum for CR and DB values using a query!Harry.SQLserver@gmail.comHarry.SQLserver@gmail.com |
|
|
|
|