Hello,
I've got a bit of an issue I don't know how to handle. I am trying to display an HTML listbox that allows multiple selections. Within the box, I want to list all of the accounts a particular company has. On top of that, I want the accounts that a particular user has access to to be selected. Here are my tables:
Accounts Table:
|-------------------------------------------
| accountid | clientid | accountname|
| 1 | 1 | Account1 |
| 2 | 1 | Account2 |
| 3 | 1 | Account3 |
Access Table:
|-------------------------------------------
| accessid | accountid | user id |
| 1 | 1 | 1 |
| 2 | 3 | 1 |
So, essentially, my first query builds the information for the listbox:
SELECT accountid, accountname from Accounts WHERE clientid=1;
Then, I would have a second query to see which accounts the user has access to:
SELECT accountid from Access WHERE userid=1;
My question is this....how do I combine these queries and get the list box to list all of the accounts for this client AND select the ones that the user has access to?
Thank you SO much!
Jason
|