I'm having trouble converting my sql to Laravel Query.
$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'
));
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire