View Single Post
  #11 (permalink)  
Old 12-01-09, 06:40
samosamo samosamo is offline
Registered User
 
Join Date: Nov 2009
Posts: 5
SQL Syntax Error

Please, I need another assistance in my SQL statement.

I have two tables - (a)RewardSystem table & (b) customer table. I want to perform an INNER JOIN and at the same time GROUP the result with COUNT FUNCTION but i keep getting error message below:

Error Message:
Column 'RewardSystem.id is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause


Here is my SQL Query:
SELECT RewardSystem.id, RewardSystem.Activity, RewardSystem.DateTimeStamp, RewardSystem.No, customer.lastName + ', ' + customer.firstName AS MemberName, customer.membershipNumber FROM RewardSystem INNER JOIN customer ON RewardSystem.CustomerID = customer.id GROUP BY RewardSystem.CustomerID



Please, what can I do? I cannot GROUP OR DO PERFORM COUNT / SUM Function.

Any assistance will be highly appreciated.

Regards,
Reply With Quote