in reply to Re: Error in query with DBD-SQLite-1.37 - Aggregate functions are not allowed in the GROUP BY clause.
in thread Error in query with DBD-SQLite-1.37 - Aggregate functions are not allowed in the GROUP BY clause.

No its giving the same error when I ran it on SQLite-3.7.11 command line. Please check my updated answer with new findings and guide me with troubleshooting this issue.
  • Comment on Re^2: Error in query with DBD-SQLite-1.37 - Aggregate functions are not allowed in the GROUP BY clause.

Replies are listed 'Best First'.
Re^3: Error in query with DBD-SQLite-1.37 - Aggregate functions are not allowed in the GROUP BY clause.
by Corion (Patriarch) on Jul 30, 2012 at 12:07 UTC

    If it does not work on the sqlite3 command line then it is a problem with SQL and SQLite. There is very little we can do from a Perl perspective.

    As your SQL statement is quite long, try reducing the columns and aggregates.

    The error message says that you try to GROUP BY something that is an aggregate function, which SQLite does not allow (and which does not make much sense to me either). Consider moving your subselects into views maybe to disambiguate the aggregates etc.

      Can u please help me in troubleshooting why DBD-SQlite is unable to detect the the current SQLITE version? The strange thing is that the same query with GROUP BY is running fine with DBI but not on command line.

        The following will give you the module version:

        perl -MDBD::SQLite -e 'print $DBD::SQLite->VERSION'

        The following will give you the SQLite version:

        perl -MDBI -e "print DBI->connect('dbi:SQLite:dbname=:memory:')->{sqli +te_version}´"

        saumitra121:

        As I understand it, when you install DBD::SQLite, it builds into itself a version of SQLite. So if you change versions of DBD::SQLite, you likely have a different version of SQLite as well. If SQLite added some features and changed how it parses statements, then that could explain why it worked in a different version of DBD::SQLite. Try reading the release notes and list of changes of both DBD::SQLite versions to find the versions of SQLite used, then review the SQLite docs and see what changed between those versions. Digging around on an SQLite support group might yield some answers...

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.