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
 General SQL Server Forums
 New to SQL Server Programming
 Excluding based on specific criteria

Author  Topic 

nbs
Starting Member

22 Posts

Posted - 2007-01-02 : 15:03:41
I am trying to accomplish the following.

There are two tables. the second one is a table that contains fields based on which the exclusion logic has to be written. It has 5 fields and there may be data in all of them or only in some of them.

The first and second table have one field in common - the Account number.(ACCT_NUM)


the exclusion is based in steps..

1) if it has all the fields in the second table for that account number, then compare all of them..
2) if only 4 of them are present,compare and check for null for the rest
3) if only 3 of them are present,compare and check for null for the rest
4) if only 2 of them are present,compare and check for null for the rest.

how do i do this... pls suggest

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-02 : 15:05:00
Do you have some sample data?
When comparing the two columns, does it matter which columns in table1 to be searched?
If two columns are present, does it matter which order the hits are matched? Do both columns has to be present? Or ony one of them? What it the two columns has same value (for example 25), does value 25 need to be present only one time or two times in table1 and same record?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -