0
update `access_tokens` as at3 set at3.`expires` = 1393995576
where
`access_token_expires` > 1393995576
and at3.`id` in (select * from (
select `at2`.`id` from `refresh_tokens` as `rt`
left join `access_tokens` as `at` on `at`.`id` = `rt`.`access_token_id`
inner join `access_tokens` as `at2` on `at2`.`session_id` = `at`.`session_id`
where `rt`.`refresh_token` = 's2kF5Ev6NXncnTPwVz99ksgsCGXfwPIDzXJMZJqz') as t)
我正在使用查詢生成器在laravel 4中查詢以上查詢。但無法找到如何寫這個。我寫這高達:如何使用查詢生成器在laravel 4中編寫此查詢
DB::table("access_tokens as at3")
->whereIn('id', function($query) use ($authParams)
{
$query->select('at2.id')
->from('refresh_tokens as rt')
->leftJoin("access_tokens as at", "at.id", "=", "rt.session_access_token_id")
->join("access_tokens as at2", "at2.session_id", "=", "at.session_id")
->where('rt.refresh_token', '=', $authParams['refresh_token']);
})
//->delete();
->where('at3.access_token_expires', '>', time())
->update(array('at3.access_token_expires' => time()));
謝謝。我知道這種方式。我試圖找到是否有任何解決方法。任何方式感謝答覆。 –