Query and loop records... HELP!
I'm looking for some feedback and advice from anyone willing to help with the problem below.
I've been handed a phone directory database for use on our Intranet. We need to be able to add, edit, and print directly from the Intranet Administration areas. The problem I believe is going to be with the database design.
Currently, it's set up like so:
department | subdepartment | last | first | phone...
With entries like so:
sheriff patrol doe john 999-9999
sheriff booking smith james 999-9999
sheriff records jones davey 999-9999
On viewable pages, the plan is to have a user select a department from a drop down menu and on a foloowing page, display the first subdepartment (if one's present), then display all users within that subdepartment, then move on to the next subdepartment and so on..
The "Sheriff" employees can be found at:
John Doe - 999-9999
James Smith - 999-9999
Davey Jones - 999-9999
If I loop through the records, it returns the above layout 3 seperate times. I know why it's doing this, but not how to combat the problem. Should I have the database reformetted to better accomodate my needs, or is there a way to single out the data I need as shown above. If the databse could be better setup, I'm completely open to anyone's suggestions!