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 |
jimmyjazz1978
Starting Member
11 Posts |
Posted - 2014-10-11 : 07:32:55
|
I have a table like this . Table b.Business Function Location Restricted Age in Days Marketing London >=9IT Geneva <=9Based on this table I need to exclude data in my main data table, table a which has Business Function and Age in Days . The problem is that the Age in days column above has an operator and the data.To exclude I want to do the following..select [Case No], casewhen b.{business function] is not null and a.[age] is like the >=9 or what the matching criteria isthen 'Y'Else 'N'END as [ Record to Exclude]from table a join table b on a.[business function]=b.[business function] and a.[age]=b.[age]?So how to I amend the sql to get it to exclude the records in table a based on the rule in table b so it is dynamic ?Bizzare |
|
bitsmed
Aged Yak Warrior
545 Posts |
Posted - 2014-10-12 : 14:09:11
|
Please provide sample data from both tables like this [url]http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx[/url] |
|
|
|
|
|