Hey all,
I have two mysql tables one has events and the other has dates related to these events.(each date is a different row) So a relation would look like this
Table 1__________Table 2
Event A______ -(event a) Date 1
_________ -(event a) Date 2
____________ -(event a) Date 3
the first sql call is basically a
This grabs all events and then I loop through the output to show things like event names.
The second sql call is
-select * from table_2 where event_id = $event id
$event_id comes from the first sql call.
I then loop through all the dates that match each event id and show them. This way I get a table that looks like:
Event 1: Date 1 | Date 2 | Date 3 |
This all works fine, but the issue im running into is that I am trying to put sorting in. I have column headers which I am allowing the user to click on to sort and it switches between ASC/DESC and the database column name to sort by. Sorting works fine eg ORDER BY table_1.name ASC if it is all in one table, however I would like to allow sorting by each of the dates as well, but everytime I do a join on the two tables, the same event will loop the number of times there are dates.. eg 8 dates loops my event 8 times instead of looping once and allowing me to access all 8 dates. Any ideas?