Search code examples
mysqlsqlmysql-error-1064mysql-error-1111

some help with aggregate functions


I am trying to create a dynamic table using php but needed to get the query below to work normaly but am experiencing an error which I have given below the query. I need some help to fix it.

SELECT test_case_name AS 'Test Case', 
       AVG( no_of_satelites ) AS 'Mean Number of Satelites', 
       AVG( hdop ) AS 'Mean of HDOP', 
       AVG( longitude ) AS 'Mean of Longitude', 
       STD( AVG(  longitude ) ) AS 'StdDev of Longitude', 
       AVG( latitude ) AS 'Mean of Latitude', 
       STD( AVG( latitude ) ) AS 'StdDev of Latitude',
       ( 1.114 * pow( 10, 5 ) * STD( AVG( latitude ) ) ), 
       ( 1.114 * pow( 10, 5 ) * STD( AVG( longitude ) ) ) 
FROM  test_cases, gga_raw_data
WHERE gga_raw_data.test_case_id = test_cases.test_case_id 
GROUP BY test_case_name

The error says:

1111 - Invalid use of group function

Any suggestion or clues would be appreciated.


Solution

  • Too many left parentheses. You have 2 more left parentheses than right parentheses.

    This is the piece of the query that is imbalanced:

    (( 1.114 * pow( 10, 5 ) * STD( AVG( latitude ) ) ) ,
    (( 1.114 * pow( 10, 5 ) * STD( AVG( longitude ) ) )