我无法将我的sql转换为Laravel查询。
$users = DB::select(DB::raw(
'SELECT User.*, Registration_Update.created_at as lastRegistrationUpdate
FROM User
JOIN Registration_Update
ON Registration_Update.user_id = User.id
WHERE Registration_Update.created_at = (
SELECT MAX(Registration_Update.created_at)
FROM Registration_Update
WHERE User.id = Registration_Update.user_id
)
AND Registration_Update.deleted_at IS NULL'
));
答案 0 :(得分:0)
已解决代码:
thing