안녕하세요이 같이 및 웅변 사용하지 않고 Laravel 5.5 쿼리 빌더에서 변환해야하고 매김Laravel 5.5의 복잡한 쿼리 작성기?
select lt.country_name, u.user_id, u.real_name from users u
join lang_table lt on lt.language_id = u.country
where not exists (select fr2 from friends where fr1 = 1 and fr2 = u.user_id and status = 1) and not exists(select fr1 from friends where fr2 = 1 and fr1 = u.user_id and status = 1)
and u.user_id <> 1
and u.country = 1
다음과 같은 변종을 많이 시도하지만 매번 나에게 줄을 가질 필요가있어 원시 쿼리 누군가가 나를 도울 수 있다면 오류가 발생합니까?
$data = DB::table('users')
->join('lang_table','lang_table.language_id', '=' ,'users.country')
->select('lang_table.country','users.user_id','users.real_name')
->select(DB::raw(where not exists (select fr2 from friends where fr1 = 1 and fr2 = u.user_id and status = 1) and not exists(select fr1 from friends where fr2 = 1 and fr1 = u.user_id and status = 1)
and u.user_id <> 1
and u.country = 1))
->paginate(25);
받은 오류는 무엇입니까? – Jerodev
SQLSTATE [4200] : 구문 오류 또는 액세스 위반 : 1064 SQL 구문에 오류가 있습니다. MariaDB 서버 –
에 해당하는 설명서를 확인하십시오. 쿼리 작성기에서 문제가 존재하지 않는 절에서 왔다고 생각합니다. 내가 생각하는이 명령의 아날로그가 있고 DB :: raw는 어떤 이유로 받아 들여지지 않는다. –