将mysql join转换为主义sql join

时间:2019-01-23 10:02:21

标签: mysql doctrine-query

我无法使用学说查询语言在查询中使用 where 条件和 order by limit

我正在使用学说查询语言,但无法执行,但是我在mysql中具有相同的查询,但工作正常。以下代码采用原理查询语言:

$queryBuilder->select('ppp.payperiodSdesc, ppesa.grossPay, 
pptpp.pfEmployerContribution, pptpp.esiEmployerContribution, pplw.employercontribution')
      from(PyProcessEmpStatusApproved::class, 'ppesa')
      leftJoin(PyProcessTdsPfPt::class, 'pptpp', 'with', 'ppesa.ouCode = pptpp.ouCode')
      leftJoin(PyPayGroup::class, 'ppg', 'with', 'pptpp.pgCode = ppg.pgCode')
      leftJoin(PyProcessLabourWelfare::class, 'pplw', 'with', 'ppg.pgCode = pplw.pgCode')
      leftJoin(PyPayPeriod::class,'ppp','with','pplw.payperiodCode = ppp.payperiodCode')
      leftJoin(PyPayrollCalendar::class, 'ppc', 'with', 'ppp.paycalCode = ppc.paycalCode')
      where('ppesa.ouCode = ?15000')
      setParameter('15000', $postData['ouCode'])

这是 mysql 代码,正在运行,并且希望转换为教义查询语言:

select ppp.payperiod_sdesc,
       ppesa.gross_pay,
       pptpp.esi_employer_contribution,
       pptpp.pf_employer_contribution,
       pplw.employerContribution
from  py_process_emp_status_approved
AS ppesa 
left join py_process_tds_pf_pt AS pptpp on ppesa.ou_code = pptpp.ou_code 
left join py_pay_group AS ppg on pptpp.pg_code = ppg.pg_code
left join py_process_labour_welfare AS pplw 
on ppg.pg_code = pplw.pg_code
left join py_pay_period AS ppp 
on pplw.payperiod_code = ppp.payperiod_code
left join py_payroll_calendar AS ppc
on ppp.paycal_code = ppc.paycal_code
WHERE ppesa.ou_code = 15000 ORDER BY ppesa.ou_code DESC LIMIT 0,5

我想用学说查询语言转换 mysql 代码。

0 个答案:

没有答案