I want to print some of my database's contents out into a table. If you click on a column heading, it will print out a sorted table.
I have data from 3 different tables that need to be put into this one html table. So I figure I print out everything from the 1st table, then add the 2nd table, and then the 3rd table's data goes in as the last column of the html table. This works fine.
The problem comes with sorting the table. The only thing these 3 db tables have in common is an ID. So when I print the html table originally, everything's fine because everything is ordered by ID and, therefore, matches up correctly.
But if I want to sort by product, it will sort the one table fine, but the others don't have that attribute. So when I print the data from those tables out, they aren't going to be matched up with the correct ID any more.
Is there any way to make the sorting still work correctly?
The only thing I can think of is to put all the data that needs to be printed out into 1 table, but that doesn't make for the best database design.
Should I have posted this in a specific language forum instead?