List Info

Thread: -=(ASP-Support-Group)=- Same Error in Query




-=(ASP-Support-Group)=- Same Error in Query
user name
2006-05-12 12:56:12
Thanks for your help. But it still shows error if i add one more variable from Award table.
Script error detected at line 26.
Source line: Set rs = con.Execute("SELECT E.Award1, SUM(E.Award_No) as cc,E.Name1 FROM Award E where E.Award_Date >= #" &
date1 & "# and E.Award_Date <= #" & date2 & "# GROUP BY E.Award1 ORDER BY sum(E.Award_No) desc")
Description: [Microsoft][ODBC Microsoft Access Driver] You tried to execute a query that does not include the specified
expression 'Name1' as part of an aggregate function.
 
Set rs = con.Execute("SELECT E.Award1, E.Name1, SUM(E.Award_No) as cc FROM Award E where E.Award_Date >= #" & date1 & "# and
E.Award_Date <= #" & date2 & "# GROUP BY E.Award1 ORDER BY sum(E.Award_No) desc")
 
If i remove E.Name1 variable it works fine but i need rest of the variables too from Award table.
 
Thanks again,
 
Kathy


Get amazing travel prices for air and hotel in one click on Yahoo! FareChase
-=(ASP-Support-Group)=- Query works fine but data is wrong
user name
2006-05-12 14:21:48
Actual Data in Microsoft Access:
Emp_ID Name1 &nbsp;Award_Date Award_No&nbsp;Award1
19 Armando Suarez&nbsp;5/1/2006&nbsp;1 ; Best Employee
19 Armando Suarez&nbsp;5/2/2006&nbsp;1 ; Best Employee
19 Armando Suarez&nbsp;4/4/2006&nbsp;2 ; Performance
19&nbsp;Armando Suarez&nbsp;3/2/2006&nbsp;2 ; Performance

Set rs = con.Execute("SELECT E.Name1 as ss, E.Award1 as kk, SUM(E.Award_No) as cc FROM Award E where E.Award_Date >= #" &
date1 & "# and E.Award_Date <= #" & date2 & "# GROUP BY E.Award1,E.Name1 ORDER BY sum(E.Award_No) desc")
date1=1/1/06
date2=5/12/06

Data After Query
REWARD REPORT
Name  &nbsp;Reward  &nbsp;No of Rewards&nbsp;
Armando Suarez  Performance  &nbsp;4
Armando Suarez  Best Employee  &nbsp;2

It should be
Performance 2
Best Employee 2
 
Thanks,


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )