AnsweredAssumed Answered

SQL Count(*) and Filemaker Fields

Question asked by tigerdwn on Jul 16, 2014
Latest reply on Jul 16, 2014 by philmodjunk

Title

SQL Count(*) and Filemaker Fields

Post

     I am trying to run the following query but am receiving the "?"

     If I remove the Count(*) line, the the query works.  Same thing if I remove the two lines after the count(*).  What am I missing?

     ExecuteSQL (
     "SELECT  
             count(*) as TouchCount,
             
             Year(MeetingDate) as TouchYear,
             
             Month(MeetingDate) as TouchMonth       
         
           FROM AccountTouches AS s
           WHERE \"_fkAccountID\" = ?  
           GROUP BY YEAR(MeetingDate), Month(MeetingDate)
           ORDER BY YEAR(MeetingDate), Month(MeetingDate)     
      
      
      "
     ; " | " ; Char(13) ;100 )
      
      
     Here is the solution.  PhilModJunk made me think differently about the problem.  The solution is to group by the column name and not applying a function to the column.  Thank you for your help.
      
          ExecuteSQL (
          "SELECT 
               Month(MeetingDate) as TouchMonth,
               Year(MeetingDate) as TouchYear,
               count(*) as TouchCount
                      
                FROM AccountTouches AS s
                WHERE \"_fkAccountID\" = ?
                Group By MeetingDate
           
               
                  
                 
                   "
          ; "  " ; Char(13) ;370 )

      

Outcomes