Reputation: 515
I m writing a query in Doctrine 2.3.3, where i want to retrieve data from 4 different tables. Now i have written a query which works on single join. But when i write multiple join queries it shows an error..
My query is
$query = $parent->entityManager->createQuery('SELECT t,s,q,d FROM TblEmployee t JOIN TblEmployeeShifts s JOIN TblEmployeeQualification q JOIN TblEmployeeDepartment d where t.employeeId = s.employeeId and t.employeeId = d.employeeId and t.employeeId = q.employeeId and t.employeeId ='.$data);
but the above query gives me an error, shown below,
[Syntax Error] line 0, col 89: Error: Expected =, <, <=, <>, >, >=, !=, got 'q'
Pls guide me where i m stepping wrong..
Upvotes: 0
Views: 2017
Reputation: 515
This is one of the ways using which we can execute Mulitple Joins in Doctrine
$query = $parent->entityManager->createQuery('
SELECT t,s,d,q
FROM TblEmployee t
JOIN TblEmployeeDepartment s WITH t.employeeId = s.employeeId
JOIN TblEmployeeShifts d WITH t.employeeId = d.employeeId
JOIN TblEmployeeQualification q WITH t.employeeId = q.employeeId
and t.employeeId = '.$data
);
Upvotes: 2