On 6/18/2014 12:19 PM, claude.pom...@free.fr wrote:
i have query like this

SELECT SUM(apport.poid) AS poid,
SUM(apport.quantite) as nb,
provenance.provenance,
touches.label as label,
apport.ladate
FROM apport
JOIN provenance ON apport.id_provenance = provenance.id_provenance
JOIN touches ON apport.id_touches = touches.id_touches
WHERE ladate BETWEEN "2014-01-01" AND "2014-12-31"
GROUP BY apport.id_touches
ORDER BY provenance.provenance, date(apport.ladate), apport.id_touches;

in mysql result is sorted like "order by" condition but in sqlite3, the data are only 
sorted by the fist argumement of "order by" condition
removing provenance.provenance order by apport.ladate but not by 
apport.id_touches

Are you sure MySQL even accepts this query? You are selecting and ordering by fields that you are not grouping by, nor wrapping in aggregate functions. That's not valid SQL; SQLite accepts this as an extension, but many other systems reject it. I thought MySQL was one of the latter.

Anyway, in a group of rows with the same apport.id_touches, there may be rows with different values of provenance.provenance. Which one of those values do you expect to be selected, and which one do you expect to be used to order the group?
--
Igor Tandetnik

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

Reply via email to