2013-06-29 187 views
0

什麼是中等效雄辯查詢:我想出了這個等效雄辯查詢

SELECT `ip` 
FROM items INNER JOIN ips ON items.client_id = ips.cient_id 
WHERE serial_key = 12345 

DB::table('items') 
    ->join('ips', 'items.cient_id', '=', 'ips.client_id') 
    ->where('items.serial_key', Request::get('serial_key')) 
    ->select('ip') 
    ->first(); 

返回null。

我怎麼知道它是否也找到了記錄?

回答

1

你必須在調用一個錯字到join()

join('ips', 'items.cient_id', '=', 'ips.client_id') 
        ^^^^^^^^ 
+0

F * CK我傻:-) – adredx