Hi Eduardo:

As Petite have mention, the following query 
select    id, category_id, name, min(price) as minprice
from       cat_pictures
group by category_id;



is missing the "id" and "name" columns in the GROUP BY clause ... per standard 
SQL standard requirement.  If the above works, it is a SQLite "feature" or 
mis-feature.


Regards.


-----Original Message-----
From: Petite Abeille <petite.abei...@gmail.com>
To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
Sent: Wed, Aug 27, 2014 2:04 pm
Subject: Re: [sqlite] Window functions?



On Aug 27, 2014, at 10:57 PM, Eduardo Morras <emorr...@yahoo.es> wrote:

> Sorry, don't understand why others will throw an exception in the group by, 
perhaps I'm misunderstanding the group by, but that should work on others 
engines.

Because not all expressions are accounted for, i.e.:

"not a GROUP BY expression

Cause: The GROUP BY clause does not contain all the expressions in the SELECT 
clause. SELECT expressions that are not included in a group function, such as 
AVG, COUNT, MAX, MIN, SUM, STDDEV, or VARIANCE, must be listed in the GROUP BY 
clause.

Action: Include in the GROUP BY clause all SELECT expressions that are not 
group 
function arguments.”

Try it. See what happen.



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

 

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to