displaying results from two tables as seperate blocks
This is probably basic coding for most of you but I've been trying to find out how to do this.
I have 2 tables of data,
the first table "ranks" has 3 columns, Rank_id, Rank_desc, Rank_order
the second table "roster" has many columns but I only want to display a few of them.
roster_id, member_name, roster_rank.
it's a one to many relationship as each rank can have many members. so ranks.Rank_id and roster.roster_rank are the linking primary keys
I need a query which will select each rank and all the members that have that rank and display each rank and members in a seperate block in the template, so that the results on the page would show like this:
Rank officers
bob
harry
john
Rank corporals
mike
sally
peter
Rank Private
Tom
Rich
Harry
Could someone please let me know how to do this? I've spent several hours looking up code and can't find the solution to this.
|