Multiple conditions on select query

Posted by stats101 on Stack Overflow See other posts from Stack Overflow or by stats101
Published on 2012-11-02T16:34:51Z Indexed on 2012/11/02 17:02 UTC
Read the original article Hit count: 230

Filed under:
|

I have a select statement and I wish to calculate the cubic volume based on other values within the table. However I want to check that neither pr.Length_mm or pr.Width_mm or pr.Height_mm are NULL prior. I've looked at CASE statements, however it only seems to evaluate one column at a time.

SELECT 
      sa.OrderName,
      sa.OrderType,
      pr.Volume_UOM
 ,pr.Length_mm*pr.Width_mm*pr.Height_mm AS Volume_Cubic
 ,pr.Length_mm*pr.Width_mm AS Volume_Floor
 ,pr.Length_mm
 ,pr.Height_mm
 ,pr.Width_mm
FROM CostToServe_MCB.staging.Sale sa
LEFT JOIN staging.Product pr
ON sa.ID = pr.ID

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2008