metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Portosa <alessandro.port...@eng.it>
Subject Error when using GROUPBY and ORBERBY with different fields
Date Thu, 03 Mar 2016 17:02:48 GMT
Hi meta-folks,
I'm having a problem when trying to supply some SQL query to MetaModel 
(4.5.1).

1) If i use SELECT SUM(total_children) AS total_children_SUM, city AS 
city FROM schema.table GROUP BY city I get the right results.
2) If i use (SELECT SUM(total_children) AS total_children_SUM , city AS 
city FROM schema.tableGROUP BY city ORDER BY city asc then I get the 
right results.
3) But if I use*SELECT SUM(total_children) AS total_children_SUM, city 
AS city FROM schema.table GROUP BY city ORDER BY country asc *I wrong 
results. I do get results, but these are the same as 1) where no 
ordering was required. The same happen with I use any other field that 
is not city (which is the field that I'm using for the grouping).

This is how I use it:

    /String newSqlQuery =
    Query query = dataContext.parseQuery(newSqlQuery);//
    //CompiledQuery cQuery = dataContext.compileQuery(query);//
    //DataSet dataSet = dataContext.executeQuery(cQuery);/

No error or exception. Just wrong data.

Any ideas?

Many thanks!
Alessandro.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message