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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Summing a field defined in a case

Status
Not open for further replies.

trulyblessed

Programmer
Feb 10, 2003
15
0
0
US
I have the following line and I would like to sum on "scripts" but it keeps telling me that "scripts" is not a valid column name. Any suggestions?

Scripts = case PaymentTypeId when '3' then p.tpm when '2' then p.tpm when '1' then p.cash else 1 end
 
Hi,

Try this...........


Select Sum(case PaymentTypeId when '3' then p.tpm when '2' then p.tpm when '1' then p.cash else 1 end) from TBL

Hope this helps.......

Sunil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top