citychap26
Programmer
Hi All
I am having a nightmare trying to produce what I would've normally done in a stored proc. Here's the problem.
I have created an exclusion table (tblRecNodesDef) for products to be excluded:
ACCOUNT, SRC_SYS, SEGMENT, EXCLUDE, VALUE
13, BND, economic_category, Y, BB
13, BND, economic_category, Y, BC
...
I have a query called exclude_Econ_Cat:
SELECT a.*
FROM tblX AS a, tblRecNodesDef AS b
WHERE a.GLAccount= b.Account
AND b.SRC_SYS='BND'
AND a.Economic_Category = b.VALUE
AND b.SEGMENT = "Economic_Category"
and EXCLUDE = 'Y';
It returns fine. I have the same query above for
Loan_Status, Boe_Category, Unit_ID and a couple of others.
What I want to do is delete from a temp_table based on tblX where the records match whats in exclude_Econ_Cat.
I have tried
Delete from temp_table where exists(select * from exclude_Econ_Cat)
it tried to delete all records in temp_table.
Anyone know how to get this to work?
Cheers
SK
I am having a nightmare trying to produce what I would've normally done in a stored proc. Here's the problem.
I have created an exclusion table (tblRecNodesDef) for products to be excluded:
ACCOUNT, SRC_SYS, SEGMENT, EXCLUDE, VALUE
13, BND, economic_category, Y, BB
13, BND, economic_category, Y, BC
...
I have a query called exclude_Econ_Cat:
SELECT a.*
FROM tblX AS a, tblRecNodesDef AS b
WHERE a.GLAccount= b.Account
AND b.SRC_SYS='BND'
AND a.Economic_Category = b.VALUE
AND b.SEGMENT = "Economic_Category"
and EXCLUDE = 'Y';
It returns fine. I have the same query above for
Loan_Status, Boe_Category, Unit_ID and a couple of others.
What I want to do is delete from a temp_table based on tblX where the records match whats in exclude_Econ_Cat.
I have tried
Delete from temp_table where exists(select * from exclude_Econ_Cat)
it tried to delete all records in temp_table.
Anyone know how to get this to work?
Cheers
SK