El jueves, 8 de marzo de 2018 6:36:43 (CET) Jan Hebler escribió: > Am Mittwoch, 7. März 2018 12:19:47 UTC+1 schrieb Sergio Cambra: > > SQL standard requires to include every column in select in the group by, > > but > > traditionally mysql didn't require it and it allowed to select more > > columns > > than columns in group by clause. However newer versions of MySQL have > > strict > > sql enabled, and don't allow it. If you are using MySQL, probably easier > > way > > is disabling strict sql mode, so you don't have include every column in > > group > > by clause. If you use a different db than mysql, you should check how it > > works. > > Im using Postgres, so no Chance. My hope was that there is an way or option > to tell AS to use the order of the ID's from the first query(which is > correct) to display the data from the second query properly sorted. My next > try will to add an subquery via the custom_finder_options and sort by the > result. However, this ist not an esay task for me, so i will delay it for > now and stay with the slow function-based sorting.
It's rails who is using 2 queries, ActiveScaffold will use a line like: Model.includes(associations).group('tbl_node.node_id).order('sum(vulnerabilities.score) ASC, "tbl_node"."node_id" ASC').limit(33).offset(0) And rails issues 2 queries to db server. I don't know if there is a better way to make queries with group and includes in rails. Regards -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails Gem" group. To unsubscribe from this group and stop receiving emails from it, send an email to activescaffold+unsubscr...@googlegroups.com. To post to this group, send email to activescaffold@googlegroups.com. Visit this group at https://groups.google.com/group/activescaffold. For more options, visit https://groups.google.com/d/optout.