I think this should be easy, but it's evading me. I've got a many-to-many relationship between Accounts and Account Groups. An Account can be in zero or more Groups, so I'm using the standard join table.
Accounts
--------
ID
BankName
AcctNumber
Balance
AccountGroups
-------------
ID
GroupName
JoinAccountsGroups
------------------
AID
GID
I'm using MS Access, FWIW. Also, this is for a low-bandwidth situation, so code optimization isn't as important as simplicity/readability.
I'm using php as a presentation layer, so a bare-bones result from Access is fine.
As for what to do with the multi-result situation, I actually have two things I'm trying to build. The first lists all the groups in one column thus:
Bank AcctNum Balance Groups
--------|--------------|----------|----------------
Citi 930938 400 Payroll
HSBC 8372933 100 Monthly, Payroll
Wells 09837 800 -
Chase 8730923 250 Monthly
The second is a master-detail list:
Name AcctNum Balance
------------|----------|----------
Payroll (2) 500
Citi 930938 400
HSBC 8372933 100
..................................
Monthly (2) 350
HSBC 8372933 100
Chase 8730923 250
..................................
Wells 09837 800
For the master-detail, my plan was just to get a big result set from the db, and munge it in php as needed. Since there's going to be some significant post-processing in php anyway, maybe I should just do three separate queries and do the joining there. (Since I'm more comfortable with that language.)