Reputation: 3697
I am wanting to produce a query which allows me to select multiple records depending on the previous available records. Let me explain.
I have a table which holds 100 records with 3 different clients and region dependent. i.e.
Record 1 belongs to client 1 and appears in regions: 1, 2, 3
Record 2 belongs to client 1 and appears in regions: 1, 2
Record 3 belongs to client 2 and appears in regions: 1, 2
Record 4 belongs to client 3 and appears in regions: 2, 3
Now, if I enter region 1 as my option to search, I would see record 1, 2, 3. If I enter region 2 as my option I would like to see records 1, 2, 3 but not record 4 because I already have 2 other clients.
Now, if I enter region 3 as my option I would like to have returned record 1, 4.
I basically want to do a limit on the result but not on the amount of records returned, but on the different regions. So show all records that exist for the first 2 available regions.
Hope this can be done.
Cheers
Upvotes: 0
Views: 310
Reputation: 527193
It would probably be simpler to do this as two queries:
Upvotes: 2