Link to home
Start Free TrialLog in
Avatar of ipaman
ipaman

asked on

How to create a select statement with a conditional

I have the following sql:
select sum(qty * unit_cost) from table1 where id=@id

I need to revise this such that if the qty value is -1, I want to make it 1 and then multiply unit_cost

Can anyone help?
Thx,
ipaman
ASKER CERTIFIED SOLUTION
Avatar of nexusnation
nexusnation
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ipaman
ipaman

ASKER

i am using SQL Server 2005
Did it work?  I'm not sure it SQL Server 2005 has that function.