Re: Sorting table columns dynamically on normalized MySQL tables
| From: | Chris Boget | Date: | Tue, 19 Apr 2005 19:23:53 +0000 |
| Subject: | Re: Sorting table columns dynamically on normalized MySQL tables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213403@lists.php.net to get a copy of this message | ||
> I can do that, but is there a better way? How do you all handle
> dynamic sorting of normalized DBs?
Firstly, what DB are you using?
Secondly, just select and sort on the columns. An example query
would be:
SELECT
course.name,
location.name,
instructor.name
FROM
course
INNER JOIN location ON location.id = course.locationID
INNER JOIN instructor ON instructor.id = course.instroctorID
ORDER BY instructor.name
(or location.name or course.name).
It should be as simple as that...
thnx,
Chris