I have three tables in mysql that I am trying to query with php. I am horible with joins and need to figure out how to format like below. I think I need two queries.. one to grab the subtitle and one to grab the list of link, right? How do I go about this...

Prefered output:
HTML Code:
<TD>
<B><a href="suburl.sub_category">subtitle.sub_category</a></B>
<BR><BR>
<a href="link_url.sub_category_links">link_title.sub_category_links</a><BR>
<a href="link_url.sub_category_links">link_title.sub_category_links</a><BR>
...



Code:
+-----------------+--------------+------+-----+---------+-------+
| Field           | Type         | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+-------+
| pid             | int(11)      |      | PRI | 0       |       |
| maintitle       | varchar(60)  |      |     |         |       |
| maindescription | text         | YES  |     | NULL    |       |
| mainphoto       | varchar(100) | YES  |     | NULL    |       |
+-----------------+--------------+------+-----+---------+-------+
4 rows in set (0.03 sec)

mysql> describe sub_category;
+----------+--------------+------+-----+---------+-------+
| Field    | Type         | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| sid      | int(11)      |      | PRI | 0       |       |
| pid      | int(11)      |      |     | 0       |       |
| subphoto | varchar(60)  | YES  |     | NULL    |       |
| subtitle | varchar(60)  | YES  |     | NULL    |       |
| suburl   | varchar(255) |      |     |         |       |
+----------+--------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> describe sub_category_links;
+------------+--------------+------+-----+---------+-------+
| Field      | Type         | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| sid        | int(11)      |      | PRI | 0       |       |
| link_url   | varchar(255) |      | PRI |         |       |
| link_title | varchar(60)  | YES  |     | NULL    |       |
+------------+--------------+------+-----+---------+-------+