Andras Belokosztolszki (1/21/2008)
You could change your case statement like:
WHEN [myRow] = 1 THEN 'True'
WHEN [myRow] IS NULL THEN 'False'
I'm using MSSQL 2000
I get a syntax error when using is null.
If I remove the is and leave the null there are no errors but not the desired result.
I would like to switch between the po date and the po line date if the po line date is null.
Here is the query:
pl.order_qty - pl.total_received_qty as "Qty Due",
convert(char(12),po.desired_recv_date,101) as "Po Want Date",
when pl.desired_recv_date IS NULL
end as "Line Want Date",
datediff(dd,getdate(), pl.desired_recv_date) as "Days Late",
purchase_order as po,
purc_order_line as pl
po.status = 'R' and
po.id = pl.purc_order_id and
(pl.desired_recv_date <= getdate()or (pl.desired_recv_date is null and po.desired_recv_date<=getdate())) and
pl.order_qty - pl.total_received_qty > 0 --and
--contact_fax is not null