{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/10728","labels_url":"https://api.github.com/repos/laravel/framework/issues/10728/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/10728/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/10728/events","html_url":"https://github.com/laravel/framework/issues/10728","id":113238796,"number":10728,"title":"lists() ambigous column","user":{"login":"okneloper","id":15017593,"avatar_url":"https://avatars.githubusercontent.com/u/15017593?v=3","gravatar_id":"","url":"https://api.github.com/users/okneloper","html_url":"https://github.com/okneloper","followers_url":"https://api.github.com/users/okneloper/followers","following_url":"https://api.github.com/users/okneloper/following{/other_user}","gists_url":"https://api.github.com/users/okneloper/gists{/gist_id}","starred_url":"https://api.github.com/users/okneloper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okneloper/subscriptions","organizations_url":"https://api.github.com/users/okneloper/orgs","repos_url":"https://api.github.com/users/okneloper/repos","events_url":"https://api.github.com/users/okneloper/events{/privacy}","received_events_url":"https://api.github.com/users/okneloper/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-25T17:36:02Z","updated_at":"2015-10-26T18:06:38Z","closed_at":null,"body":"Using lists() on a joined query when more than one table have the same column name results in a MySQL error: \r\n```php\r\n<?php\r\nDB::table('orders')\r\n    ->join('order_products', function ($join) {\r\n        return $join->on('order.id', '=', 'order_products.order_id')\r\n            ->where('order_products.item_id', '=', ITEM_ID);\r\n    })\r\n    ->groupBy('order.id')\r\n    ->where('order.paid', 1)\r\n    ->lists('order.id');\r\n\r\n// Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in field list is ambiguous' in ...\r\n```\r\nCaused by\r\nhttps://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Query/Builder.php#L1592"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/151230023","html_url":"https://github.com/laravel/framework/issues/10728#issuecomment-151230023","issue_url":"https://api.github.com/repos/laravel/framework/issues/10728","id":151230023,"user":{"login":"gnarlycharlie4","id":4528065,"avatar_url":"https://avatars.githubusercontent.com/u/4528065?v=3","gravatar_id":"","url":"https://api.github.com/users/gnarlycharlie4","html_url":"https://github.com/gnarlycharlie4","followers_url":"https://api.github.com/users/gnarlycharlie4/followers","following_url":"https://api.github.com/users/gnarlycharlie4/following{/other_user}","gists_url":"https://api.github.com/users/gnarlycharlie4/gists{/gist_id}","starred_url":"https://api.github.com/users/gnarlycharlie4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gnarlycharlie4/subscriptions","organizations_url":"https://api.github.com/users/gnarlycharlie4/orgs","repos_url":"https://api.github.com/users/gnarlycharlie4/repos","events_url":"https://api.github.com/users/gnarlycharlie4/events{/privacy}","received_events_url":"https://api.github.com/users/gnarlycharlie4/received_events","type":"User","site_admin":false},"created_at":"2015-10-26T18:06:38Z","updated_at":"2015-10-26T18:06:38Z","body":"You may find luck with `lists(DB::raw('order.id'))` which injects the plain string into the query rather than the sanitized and parsed string."}}