I hate to admit that my knowledge of MySQL is missing when it comes to more complex queries. Essentially, I have four tables, two of which contain the data I want to return, and two are relational tables linking the data. Table APresent only to provide filler for Table D.aID.
+--------+ +--------+ +--------+ +-----------+ +-----------+
|Table A | |Table B | |Table C | | Table D | | Table E |
+---+----+ +---+----+ +---+----+ +---+---+---+ +---+---+---+
|aID|name| |bID|name| |cID|name| |dID|aID|bID| |eID|dID|cID|
+---+----+ +---+----+ +---+----+ +---+---+---+ +---+---+---+
| 1 | a_1| | 1 | b_1| | 1 | c_1| | 1 | 1 | 1 | | 1 | 1 | 1 |
+---+----+ | 2 | b_2| | 2 | c_2| | 2 | 1 | 2 | | 1 | 1 | 2 |
+---+----+ | 3 | c_3| +---+---+---+ +---+---+---+
+---+----+
The relationship established with these tables: Table A > Table B > Table C. The data I want is related to relationships Table B > Table C.
+--------+---------+--------+---------+
|tblB.bID|tblB.name|tblC.cID|tblC.name|
+--------+---------+--------+---------+
| 1 | a_1 | 1 | c_1 |
| 1 | a_1 | 2 | c_2 |
| 2 | a_2 | NULL | NULL |
+--------+---------+--------+---------+
, , , Table B Table A > Table B Table C. , , name, , . , ,
SELECT * FROM `Table E`
LEFT JOIN `Table D` ON (`Table B`.bID = `Table D`.bID)
RIGHT JOIN `Table E` ON (`Table D`.dID = `Table E`.dID))
RIGHT JOIN `Table C` ON (`Table E.cID = `Table C`.cID);
. , :
ERROR 1066 (42000): Not unique table/alias: 'Table D'
, ? ?