0

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..

1 Answer 1

2

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
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.