0
我試着寫在Laravel查詢查詢與多個條件
SELECT table1. * , table2. *
FROM table1
LEFT JOIN table2 ON
(table1.id = table2.id
AND (
table2.field = ''
OR table2.field >= '0'
)
)
WHERE table.id =id
此查詢我有一個問題,如何內部AND (...)
添加到查詢laravel?以下是我迄今爲止
$query = Table::select(DB::Raw('table1.*, table2.*'))
->leftJoin('table2', function($join) {
$join->on('table1.id', '=', 'table2.id')
->where('table2.field', '=', '')
->orwhere('table2.field', '=', '50');
})
->where('table1.id', BaseController::getCurrentUser()->id)
->get();
我想在哪裏以及如何添加AND...
小幅盤整有一個類似這樣的語句後semicolen:$查詢 - > where('table2.field','') - > orWhere('table2.field',50); –