Erin Leale
asked on
SQL - Filtered on QTY field only in a View
New to using SQL - I created a view and need to add a field for the Quantity Field, I need this field to exclude one product line in my table. However, I need the Product Line on the entire table but just filtered for the quantity field. Is there a way to do this?
For example - My QTY field includes Freight. My $$ fields need to include the Freight $$'s so I can't eliminate the Freight from the entire table I just don't want the QTY field to include the Freight numbers, as it doubles the Qty Amount.
In Crystal - I would create a formula as:
If {ProductLine} = "FRGT" then 0 else {Qty}
Any help would be great! Trying to not do this report in Crystal.
Thank you.
Using MS SQL Management Studio - 2008 R2 - Free version
For example - My QTY field includes Freight. My $$ fields need to include the Freight $$'s so I can't eliminate the Freight from the entire table I just don't want the QTY field to include the Freight numbers, as it doubles the Qty Amount.
In Crystal - I would create a formula as:
If {ProductLine} = "FRGT" then 0 else {Qty}
Any help would be great! Trying to not do this report in Crystal.
Thank you.
Using MS SQL Management Studio - 2008 R2 - Free version
ASKER
SOmething like
Case ProductLine
"FRGT" : Cost
Others : Cost * Qty
End As ExtendedCost
mlmcc
Case ProductLine
"FRGT" : Cost
Others : Cost * Qty
End As ExtendedCost
mlmcc
ASKER
Hi Mlmcc:
Where in SQL do you excute a Case Statement? Is it part of the SQL statement?
Thanks.
Where in SQL do you excute a Case Statement? Is it part of the SQL statement?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will give it a try - Thank you.
ASKER
Thank you!
Can you post your data model?
Regards,
AielloJ