|
-
Aug 2nd, 2004, 12:53 AM
#1
Thread Starter
Hyperactive Member
SQL expression and ADO recordset
Hello
I have the following SQL statements which also
adds (sum) fields .
the SQL seems to b fine but I keep getting errors when
i try to open the recordset.
strGroup = "Select ReportSummary.region, Sum(q1) As Q1, Sum(q2) As Q2, Sum(q3) As Q3, Sum(q4) As Q4, Sum(q5) As Q5, Sum(q6) As Q6, Sum(q7) As Q7, Sum(q8) As Q8, Sum(q9) As Q9, Sum(q10) As Q10, Sum(q11) As Q11,Sum(q12) as Q12, count(*) as ndNumber," _
& " Sum(q1r) As Q1R,Sum(q2r) As Q2R,Sum(q3r) As Q3R,Sum(q4r) As Q4R,Sum(q5r) As Q5R,Sum(q6r) As Q6R,Sum(q7r) As Q7R,Sum(q8r) As Q8R,Sum(q9r) As Q9R,Sum(q10r) As Q10R,Sum(q11r) As Q11R,Sum(q12r) As Q12R," _
& " (Q1+q1r) AS S1,(Q2+q2r) As S2, (Q3+q3r) As S3,(Q4+q4r) As S4,(Q5+q5r) As S5,(Q6+q6r) As S6,(Q7+q7r) As S7,(Q8+q8r) As S8,(Q9+q9r) As S9,(Q10+q10r) As S10,(Q11+q11r) As S11,(Q12+q12r) As S12" _
& " From ReportSummary GROUP BY ReportSummary.region HAVING ReportSummary.Region=" & "'" & Trim(lstRegion.List(lstRegion.ListIndex)) & "'"
Set groupRs = New ADODB.Recordset
groupRs.Open strGroup, myConnection, adOpenKeyset, adLockOptimistic
The message i am getting is
The expression Q1+Q2 is not included in the aggregate function
Thank u for your time.
Please Help Each other.
if you can't at least
Do not Hurt Each Other

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|