Link to home
Start Free TrialLog in
Avatar of Erin Leale
Erin LealeFlag for United States of America

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
Avatar of AielloJ
AielloJ
Flag of United States of America image

eleale:

Can you post your data model?

Regards,

AielloJ
Avatar of Erin Leale

ASKER

AielloJ:

Is this what you need?  See attached.

Thanks.
EXPERTS-SQL.docx
Avatar of Mike McCracken
Mike McCracken

SOmething like

Case ProductLine
      "FRGT"  :  Cost
      Others  :  Cost * Qty
End  As ExtendedCost

mlmcc
Hi Mlmcc:

Where in SQL do you excute a Case Statement? Is it part of the SQL statement?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

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
I will give it a try - Thank you.
Thank you!