I have two database tables, 'customer' and 'customer projects'. The tables are linked by a common ID which is used to reference each other. Each customer can have none to several projects. Currently there is a query which prints all the projects in order of project name. In some cases I want to list the projects in order of Customer name. Is there any way this can be done via a select statement to the projects table by use of a foreign key or any other method?
Thanks, Damien.
SELECT customer_projects.* FROM customer, customer_projects WHERE customer_projects.customer_ID=customer.ID ORDER BY customer.name
Thanks nemonoman. That worked perfectly. I don't fully understand the query yet but I have to write some others so I should be more competant soon.
Thanks again.
p.s. I cannot find where to mark this thread as resolved.
Originally posted by doublehops Thanks nemonoman. That worked perfectly. I don't fully understand the query yet but I have to write some others so I should be more competant soon. Thanks again. p.s. I cannot find where to mark this thread as resolved.
Just below the end of the posts (mine now) there is Email this thread... blah blah then Mark this thread as resolved (thread starter only)