If Statement in SQL Stored Procedure
Posted on 2012-03-10
I have the select statement below.
I am trying to create an if statement if the alias DAY is Null or > 0 then a new alias Late should = 1 otherwise it would be zero. Everything I tried messes up the prior selections.
SELECT distinct ph.NAME_VND_ORDFM as Name_Vend,ph.ID_PO as PO_NBR, pl.ID_REL_ORD AS PO_REL,pl.ID_LINE_PO AS PO_LN, CONVERT(VARCHAR,pl.DATE_RCV,101)as RECEIPT,
CONVERT(VARCHAR,pl.DATE_RQST,101) as REQUEST, DATEDIFF(DAY, pl.DATE_RQST,pl.DATE_RCV) AS DAY
Any help will be appreciated.