Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jbrown7232
Starting Member
22 Posts |
Posted - 2014-06-19 : 15:25:20
|
Hello and Thanks in Advance. I have the following query:Select SKU_Number,SKU_Name,Sum(Invoice_Quantity)as Number_of_Cases,Sum(Invoice_Quantity)/COUNT(orderinvoice)as Average_Cases,SUM(SKU_Price) as Purchases,COUNT(orderinvoice)as order_count, Store_Number,Customer_Name, Customer_Address, Customer_City , Customer_State , Customer_Zip, Unitofmeasure as UOM,qtyshipped as PartialCase from Sales4000 where CustCode = 'Target'group by Store_Number, SKU_Name, SKU_Number,Customer_Name, Customer_Address, Customer_City , Customer_State , Customer_Zip,Unitofmeasure, qtyshipped I just want PartialCase column populated with the negative value only when there is a negative value otherwise just put a 0 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-06-19 : 15:35:09
|
PartialCase = CASE WHEN qtyshipped > 0 THEN 0 ELSE qtyshipped ENDTara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
jbrown7232
Starting Member
22 Posts |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|