MySQL Forums
Forum List  »  PHP

Query Across 3 tables
Posted by: Carl Stuart
Date: March 29, 2011 11:37AM

Hi,

I was wandering if anyone could help me out with a query that I need to run across multiple tables. I have 4 tables:

Authority

+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| AID | mediumint(9) | NO | PRI | NULL | auto_increment |
| Name | char(30) | NO | | NULL | |
+-------+--------------+------+-----+---------+----------------+

Library

+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| LID | mediumint(9) | NO | PRI | NULL | auto_increment |
| AID | mediumint(9) | NO | | NULL | |
| Name | char(30) | NO | | NULL | |
| PhoneNo | varchar(11) | NO | | NULL | |
+---------+--------------+------+-----+---------+----------------+

AvailableServices

+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| ASID | mediumint(9) | NO | PRI | NULL | auto_increment |
| LID | mediumint(9) | NO | | NULL | |
| SLID | mediumint(9) | NO | | NULL | |
+-------+--------------+------+-----+---------+----------------+

ServiceList

+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| SLID | mediumint(9) | NO | PRI | NULL | auto_increment |
| ServName | char(60) | NO | | NULL | |
+----------+--------------+------+-----+---------+----------------+

On my webpage, the user selects an authrority which then displays all libraries under that particular authority. This data is being displayed on the seperate page in a table. I need to be able to display the names of the services under that library in the same table. However, I can not find anyway to do it. Can anyone help me?

Regards.

Options: ReplyQuote


Subject
Written By
Posted
Query Across 3 tables
March 29, 2011 11:37AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.