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?

Edited by kris1988edwards
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.