mardi 30 octobre 2018

SQL If() On getting the Next date if tomorrows data is null

Newbie to SQL Still.

I'm trying to work with a current SQL query I made.

SELECT DISTINCT Master.Order Order, Detail.Date
FROM Master INNER JOIN Details ON Master.Order = Detail.Order
WHERE Date = DATEADD(day, 1, GETDATE())
AND Detail.House = 'MX'
AND (Master.Status <> '\'
AND Master.Status <> 'S' 
AND Master.Status <> '8'
AND Master.Status <> '9')

GROUP BY  Detail.Date, Master.Order

My goal Is to have the query pull the next result if tomorrows date has no data.

I'm thinking I need to implement a IF() statement but I'm not really sure how.

Any Suggestions?

Anything Helps.

Thank you,

Sam

Aucun commentaire:

Enregistrer un commentaire