Skip to content

order by column id not working with functions in a select #35

@GoogleCodeExporter

Description

@GoogleCodeExporter
I have a mySQL table with the following definition:

id: BIGINT
date: DATE
impressions: BIGINT

The query "select toDate(day), sum(impressions) group by day" gives the 
following results:

google.visualization.Query.setResponse({"version":"0.6","status":"ok","sig":"147
1412089","table":{"cols":[{"id":"toDate_day","label":"toDate(day)","type":"date"
,"pattern":""},{"id":"sum-impressions","label":"sum 
impressions","type":"number","pattern":""}],"rows":[{"c":[{"v":new 
Date(2012,0,27)},{"v":1.0}]},{"c":[{"v":new 
Date(2012,0,28)},{"v":1.0}]},{"c":[{"v":new 
Date(2012,0,29)},{"v":1.0}]},{"c":[{"v":new 
Date(2012,0,30)},{"v":1.0}]},{"c":[{"v":new 
Date(2012,1,1)},{"v":1.0}]},{"c":[{"v":new 
Date(2012,1,2)},{"v":1.0}]},{"c":[{"v":new 
Date(2012,1,3)},{"v":1.0}]},{"c":[{"v":new Date(2012,1,4)},{"v":1.0}]}]}});

As you can see it's given the toDate(day) column the id "toDate_day"

However, trying the following query: select toDate(day), sum(impressions) group 
by day order by `toDate_day`

Gives the invalid query error:

Column [`toDate_day`] which appears in ORDER BY, must be in SELECT as well, 
because SELECT contains aggregated columns.

This should order by toDate(day) as you can according to the documentation give 
a column ID in an order by.

I'm using version 1.1.1

Original issue reported on code.google.com by [email protected] on 15 Feb 2012 at 6:30

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions