2013-06-14 1 views
0

데이터 테이블에서 NOT IN 작업 또는 하위 쿼리를 수행하려고하지만 실제로 이러한 작업을 수행하는 방법을 구성 할 수 있습니다. 이러한 작업을 수행 할 수 있습니까? 내가 필드 form_no t_geocode 및 t_store 테이블에서 작동하지 수행 할 필요가codeigniter의 jquery 데이터 테이블에서 mysql NOT IN 연산을 수행하려면 어떻게해야합니까?

->select("t_geocode.form_no,t_store.name ,CONCAT(t_store.address,'',t_location.address) AS locaddress,t_admin.username,t_geocode.creation_date,t_geocode.notes IS NOT NULL,t_geocode.latitude,t_geocode.longitude", FALSE) 
       ->from("t_geocode") 
       ->join("t_store", "t_store.form_no = t_geocode.form_no") 
       ->join("t_location", "t_location.id = t_store.area") 
       ->join("t_admin", "t_admin.user_id = t_geocode.created_by") 
       ->where("t_geocode.is_discarded", 0) 
       ->where("t_geocode.is_pending", 1) 
       ->where_not_in("t_geocode.form_no","t_store.form_no") 
       ->add_column("username", $usernameBar, 't_admin.username,t_geocode.creation_date,t_geocode.notes IS NOT NULL') 
       ->add_column("coordinates", $cordinateBar, 't_geocode.latitude,t_geocode.longitude') 
       ->add_column("actions", $actionLinkBar, 't_geocode.form_no') 
       ->unset_column("t_store.name") 
       ->unset_column("t_store.address") 
       ->unset_column("t_location.address") 
       ->unset_column("locaddress") 
       ->unset_column("t_admin.username") 
       ->unset_column("t_geocode.creation_date") 
       ->unset_column("t_geocode.notes IS NOT NULL") 
       ->unset_column("t_geocode.latitude") 
       ->unset_column("t_geocode.longitude"); 

:

여기 내 쿼리입니다. 누군가 도움을 줄 수 있습니까? 도움이

+0

나는 CodeIgniter에 대해 아무것도 모르지만, NOT IN (실제로는 항상 빠르기 때문에 실제로 선호됨)의 표준 해결 방법은 다른 테이블의 LEFT JOIN을 지정하고 다른 테이블의 PK 값이 NULL 인 곳을 생략하는 것입니다. 일치하지 않았으므로 "안에"있지 않습니다. CodeIgniter는 "안"을 할 수 없다면 할 수있는 일입니다. 이것에 관한 SO 게시가 꽤 많이 있습니다. 내가 처음 발견 한 것은 [여기] (http://stackoverflow.com/a/1519333/2091410)입니다. –

+0

덕분에 Ed Gibbs – shivamsupr

+0

하지만 왼쪽 조인도 DataTables에서 작동하지 않습니다. – shivamsupr

답변

1
귀하의 경우에 맞게 수 이에 대한 해결 방법은 내가 당신의 열이 많이 해제되어 볼 수 표시 및 뷰에서 직접 선택하는 데 필요한 모든 조건 MYSQL보기를 만드는 것입니다

,

희망

관련 문제