clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2591627 fiddles created (45700 in the last week).

CREATE tABLE test(UserFlag varchar(100),QtyAvailable INT,OrderStatus VARCHAR(100))
 hidden batch(es)


SELECT CASE WHEN UserFlag IN ( 'On Order', 'Sold Out', 'On Order,Sold Out') AND QtyAvailable = 0 AND OrderStatus = 'Pending Fulfillment' then 'BackOrder' ELSE 'Not a BackOrder' END AS [Orders Backorder] , CASE WHEN OrderStatus in ('Billed','Partially Fulfilled','Pending Billing','Pending Billing/ Partially Fulfilled') THEN 'Shipped' ELSE 'Not Shipped' END AS [Orders Shipped] FROM test;
Orders Backorder Orders Shipped
 hidden batch(es)