I have a question with my logic. See I have table A and table B. Given the parameters entered by the user, e.g. 2200 01/22/08. I have to narrow down the results in table A. Now my problem is, after narrowing down the results, I have to check a field in table A, let's say the field is Customer No. which I will then have to check if it exists in table B. If it exists, I have to increment the number such that the number does not exist in table B.
I was thinking of doing two select statements
Select * from table A where etc etc
Select * from table B where etc ect
But how do i the checking? How will I increment and check at the same time if customer number it exists in table B. Is there a better way of doing this? Any help would appreciated.