The error is in your JOIN clause. When you're joining the same table multiple times you have to assign an alias to the table name. When a table is joined multiple times, SQL doesn't know which table to refer to.