Wednesday, March 21, 2012

Difficult SQL

Hello,

Please can anyone help?

I have got two tables, accounts and account customers.

The accounts table has more than one row for each account, identified by the account number and the sub account.

Each customer should be linked to all of the sub accounts for their account (in the account customers table).

I have found some accounts where one customer might be linked to all the sub accounts but the 2nd customer on the account is only linked to one of the sub accounts. This is wrong & needs to be corrected.

Please can anyone advise how I go about selecting all of the problem accounts.

To start with I grouped all the existing links together, I then need to somehow check each account against this main list.

Please can you advise.

Thanks,
BethBeth, describe the tables and give sample data. :confused:

No comments:

Post a Comment