{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3732","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3732/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3732/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3732/events","html_url":"https://github.com/aspnet/EntityFramework/issues/3732","id":116583270,"number":3732,"title":"Include and Take generate incorrect SQL without Skip","user":{"login":"SimonTouchtech","id":13662267,"avatar_url":"https://avatars.githubusercontent.com/u/13662267?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonTouchtech","html_url":"https://github.com/SimonTouchtech","followers_url":"https://api.github.com/users/SimonTouchtech/followers","following_url":"https://api.github.com/users/SimonTouchtech/following{/other_user}","gists_url":"https://api.github.com/users/SimonTouchtech/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonTouchtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonTouchtech/subscriptions","organizations_url":"https://api.github.com/users/SimonTouchtech/orgs","repos_url":"https://api.github.com/users/SimonTouchtech/repos","events_url":"https://api.github.com/users/SimonTouchtech/events{/privacy}","received_events_url":"https://api.github.com/users/SimonTouchtech/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/pri0","name":"pri0","color":"e11d21"}],"state":"open","locked":false,"assignee":{"login":"anpete","id":1210944,"avatar_url":"https://avatars.githubusercontent.com/u/1210944?v=3","gravatar_id":"","url":"https://api.github.com/users/anpete","html_url":"https://github.com/anpete","followers_url":"https://api.github.com/users/anpete/followers","following_url":"https://api.github.com/users/anpete/following{/other_user}","gists_url":"https://api.github.com/users/anpete/gists{/gist_id}","starred_url":"https://api.github.com/users/anpete/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anpete/subscriptions","organizations_url":"https://api.github.com/users/anpete/orgs","repos_url":"https://api.github.com/users/anpete/repos","events_url":"https://api.github.com/users/anpete/events{/privacy}","received_events_url":"https://api.github.com/users/anpete/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/18","html_url":"https://github.com/aspnet/EntityFramework/milestones/7.0.0-rc2","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/18/labels","id":1403248,"number":18,"title":"7.0.0-rc2","description":null,"creator":{"login":"bricelam","id":1226749,"avatar_url":"https://avatars.githubusercontent.com/u/1226749?v=3","gravatar_id":"","url":"https://api.github.com/users/bricelam","html_url":"https://github.com/bricelam","followers_url":"https://api.github.com/users/bricelam/followers","following_url":"https://api.github.com/users/bricelam/following{/other_user}","gists_url":"https://api.github.com/users/bricelam/gists{/gist_id}","starred_url":"https://api.github.com/users/bricelam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bricelam/subscriptions","organizations_url":"https://api.github.com/users/bricelam/orgs","repos_url":"https://api.github.com/users/bricelam/repos","events_url":"https://api.github.com/users/bricelam/events{/privacy}","received_events_url":"https://api.github.com/users/bricelam/received_events","type":"User","site_admin":false},"open_issues":65,"closed_issues":64,"state":"open","created_at":"2015-11-09T22:23:36Z","updated_at":"2015-12-15T00:16:28Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-11-12T16:17:33Z","updated_at":"2015-12-15T00:19:03Z","closed_at":null,"body":"**Version:** Beta 8\r\n**Model:** EFGetStarted.Blog\r\n**DB:** SQLite\r\n\r\n**Code:**\r\n```csharp  \r\ndb.Blogs.Include(x => x.Posts).OrderBy(x => x.Url).Take(10).ToList(); \r\n```\r\n*Note: The OrderBy call is not necessary to repro, but more clearly shows the problem (that not all posts are included)*\r\n\r\n**SQL:**\r\n```sql\r\nSELECT \"x\".\"BlogId\", \"x\".\"Url\"\r\nFROM \"Blog\" AS \"x\"\r\nORDER BY \"x\".\"Url\", \"x\".\"BlogId\"\r\nLIMIT 10\r\n\r\nSELECT \"p\".\"PostId\", \"p\".\"BlogId\", \"p\".\"Content\", \"p\".\"Title\"\r\nFROM \"Post\" AS \"p\"\r\nINNER JOIN (\r\n    SELECT DISTINCT \"x\".\"Url\", \"x\".\"BlogId\"\r\n    FROM \"Blog\" AS \"x\"\r\n    LIMIT 10\r\n) AS \"x\" ON \"p\".\"BlogId\" = \"x\".\"BlogId\"\r\nORDER BY \"x\".\"Url\", \"x\".\"BlogId\"\r\n```\r\n*(There should be an ORDER BY in the inner query)*\r\n\r\n**Workaround:**\r\n```csharp  \r\ndb.Blogs.Include(x => x.Posts).OrderBy(x => x.Url).Skip(0).Take(10).ToList(); \r\n```"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/164601878","html_url":"https://github.com/aspnet/EntityFramework/issues/3732#issuecomment-164601878","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/3732","id":164601878,"user":{"login":"divega","id":1253414,"avatar_url":"https://avatars.githubusercontent.com/u/1253414?v=3","gravatar_id":"","url":"https://api.github.com/users/divega","html_url":"https://github.com/divega","followers_url":"https://api.github.com/users/divega/followers","following_url":"https://api.github.com/users/divega/following{/other_user}","gists_url":"https://api.github.com/users/divega/gists{/gist_id}","starred_url":"https://api.github.com/users/divega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/divega/subscriptions","organizations_url":"https://api.github.com/users/divega/orgs","repos_url":"https://api.github.com/users/divega/repos","events_url":"https://api.github.com/users/divega/events{/privacy}","received_events_url":"https://api.github.com/users/divega/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T00:19:03Z","updated_at":"2015-12-15T00:19:03Z","body":"I worked with @mikary on the analysis today and it looks like there are several aspects at play in this bug and it would be better for @anpete to work on it. So I am restoring the milestone to be 7.0.0-rc2 and assigning it to him. "}}