Wednesday, 6 April 2016

[firebird-support] SQL Error Code -104: What is wrong with this rather simply SQL?

 

SELECT DISTINCT P.AREA_CODE, P.PHONE_NO,

      (SELECT COUNT(*)

        FROM PHONE P2

       WHERE P2.PHONE_ID = P.PHONE_ID) AS CNT

  FROM PHONE P             

 WHERE P.AREA_CODE IS NOT NULL

 GROUP BY 1, 2         

HAVING (SELECT COUNT(*)

          FROM PHONE P3

         WHERE P3.PHONE_ID = P.PHONE_ID

           AND P3.AREA_CODE IS NOT NULL) > 1

 

Dynamic SQL Error SQL error code = -104 Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause)

__._,_.___

Posted by: "stwizard" <stwizard@att.net>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? The Yahoo Mail app is fast, beautiful and intuitive. Try it today!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.

__,_._,___

No comments:

Post a Comment