I have 2 tables:
Table A is a category table. Columns are cid, catname.
Table B is a relationship table. Columns are cid, parent (parent is another cid).
Here's where I am so far:
"SELECT c.cid, c.catname AS catname, r.parent AS parent FROM tableA AS c JOIN tableB AS r ON r.cid=c.cid";
I know I'll get 3 columns (2 from tableA and one from tableB) but I also want to get the catname value from the parent in tableA If I were to do a second query, it would look like this (assuming we put the result into a $row variable):
"SELECT catname FROM tableA WHERE cid='".$row['parent']."'";
That way I can display it as text.
What do I add, and where? Is there a second JOIN?