Skip to content

Instantly share code, notes, and snippets.

@danfinlay
Created June 16, 2014 20:46
Show Gist options
  • Select an option

  • Save danfinlay/d76923f677bed1784c57 to your computer and use it in GitHub Desktop.

Select an option

Save danfinlay/d76923f677bed1784c57 to your computer and use it in GitHub Desktop.
SQL error on geddy/master
var Article = geddy.model.Article;

Article.all({featured: false}
  , {"limit":50,"skip":0,"includes":["Comment","User"],"sort":{"createdAt":"desc"}}
  , callback);

Creates:

SELECT DISTINCT articles."id" FROM articles LEFT OUTER JOIN comments comments ON (articles."id" = comments."article_id") LEFT OUTER JOIN users users ON (articles."user_id" = articles."id") WHERE (articles."featured" = false) ORDER BY articles."created_at" DESC LIMIT 50;

And throws error:

for SELECT DISTINCT, ORDER BY expressions must appear in select list
[Mon, 16 Jun 2014 20:38:22 GMT] ERROR for SELECT DISTINCT, ORDER BY expressions must appear in select list
error: for SELECT DISTINCT, ORDER BY expressions must appear in select list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment