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
Erin LealeConsultant/ControllerAsked:
Who is Participating?
 
mlmccCommented:
It is part of the SELECT

SELECT fields, CASE .... , fields
FROM ....

I don't have a SQL database here so the syntax is from memory.

mlmcc
0
 
AielloJCommented:
eleale:

Can you post your data model?

Regards,

AielloJ
0
 
Erin LealeConsultant/ControllerAuthor Commented:
AielloJ:

Is this what you need?  See attached.

Thanks.
EXPERTS-SQL.docx
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
mlmccCommented:
SOmething like

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

mlmcc
0
 
Erin LealeConsultant/ControllerAuthor Commented:
Hi Mlmcc:

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

Thanks.
0
 
Erin LealeConsultant/ControllerAuthor Commented:
I will give it a try - Thank you.
0
 
Erin LealeConsultant/ControllerAuthor Commented:
Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.