al4629740

asked on

# query syntax - multiply a column by 10 into another column

I need help with query syntax in SQL. I have the following SQL statement:

I have an error with the [Check Total] column calculation. I am trying to multiply the [Total Hours] by 10 for the [Check Total] column. What am I doing wrong?

```
select H.Agency,Count(distinct H.ActivityDate) as [# of days],SUM(Hours) as [Total Hours], ([Total Hours] * 10) as [Check Total], r.LastName,r.FirstName,r.BirthDate " & _
"from tblCYEPHours H inner join tblCYEPRegistrations R on H.Regid = R.RegID Where h.[Hours] > 0 and h.Agency = 'Chicago Area Project' And h.ActivityDate >= '" & DTPicker1 & "' And h.ActivityDate <= '" & DTPicker2 & "' " & _
"group by H.Agency,r.LastName,r.FirstName,r.BirthDate Order by H.Agency,r.LastName,r.FirstName
```

I have an error with the [Check Total] column calculation. I am trying to multiply the [Total Hours] by 10 for the [Check Total] column. What am I doing wrong?

ASKER CERTIFIED SOLUTION

membership

Create an account to see this answer

Signing up is free. No credit card required.

ASKER

I made a mistake. The Hour column is datatype decimal(18, 2) if that makes a difference.

ASKER

Found the issue. I had an extra parenthesis!

Glad to be of help.

ASKER

Open in new window

I get incorrect syntax near keyword 'as'