Jump to content

ELSE IF Statement


kris1988edwards

Recommended Posts

Good morning,

 

I am trying to return specific values depending on the value of the WJCStatusID, for example if WJCStatusID = < 4 but > 2 return "In production"

 

SQL QUERY: 

 

SELECT tblWJCItem.AddedDescription, 
    tblWJC.WJCPrefix + Convert(Varchar(10),tblWJC.WJCNo) AS OurRef, 
    tblWJCItem.MaterialName, tblStockFamily.StockFamily, 
    tblWJCItem.WeightToSend, 
    tblWJC.DateCreated,
    tblWJC.WJCStatusID
FROM tblWJC 
 INNER JOIN tblWJCItem ON tblWJC.WJCID = tblWJCItem.WJCID 
 INNER JOIN tblStockFamily ON tblWJCItem.ProductFamilyID = tblStockFamily.StockFamilyID
 

IF (tblWJC.WJCStatusID) < 2 THEN  'Pre Production'
   ELSE IF (tblWJC.WJCStatusID) < 4 THEN 'In Production'
   ELSE IF (tblWJC.WJCStatusID) > 4 THEN 'Ready To Ship'
    ELSE 'Awaiting Lab Results';

I am quite new to the world of mssql so I maybe doing something wrong which is quite simply to fix. Can any body help?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.