Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table.Col_Name Parameter in Aggregation

Status
Not open for further replies.

dbljackson

Programmer
Feb 8, 2001
8
US
I'm using SQL Server 7.0 and would like to use a
parameter for a table column name in a "SUM" aggregation.

Code:

Select
sum(case when Fweek=@Curweek-8 then (quantity*Dollars) else 0 end) 'Week-8'
from ....

Can the (Quantity*Dollars) expression be passed as a parameter? I have other aggregations for this same table
ex. "(total/quantity)"

I have been unsuccessful thus far but am SQL Server newbie.

TIA



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top