SQL - Select distinct but return all columns with CakePHP Find -


I'm trying to do the same as using cakephp:

  $ everyRWithCode = $ this- & gt; Movie Review- & gt; Search ('all', array ('field' => gt; movie review '', 'group' = & gt; array ('movie review' codes), 'recursive' =>, 'nifilator' '= & Gt; true,' order '= & gt;' movierevocode '));  

This code returns an error:

Error: The column "Movie Review" should appear in the group BY section or should be used in a composite function

What are you using DBMS? Mysql shows you columns that you do not use in the total function (but you are not, but there is no ether dbms, so each column that you want to show it is a composite function such as MAX) Or SUM () or COUNT ()

So you have to do this (suppose you have a number column):

$ every R isCode = $ this-> Movie Review- & gt; Find ('All', array ('field' = & gt; array ('COUNT (Movie Review.ID)', 'Average Movie ReuviewCore),' Max (Movie Reuviewcode), 'Group' = & gt; Array (' Moviereview cue '),' recursive '=>' -1 ',' nuffiller '= & gt; true,' order '= & gt; movie review code'));

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -