A table exists with id and datetime columns; I need to SELECT records from
the previous business day.     I began with this: 

 

SELECT id FROM table WHERE TO_DAYS(NOW()) - TO_DAYS(datetime) <=1 

 

But if NOW() is a Monday, it pulls records from Sunday (there are none since
records are inserted M-F only).    I thought of using something like this in
my WHERE clause: 

 

"AND DAYOFWEEK(datetime) != 6"

 

Though this doesn't seem like an operable solution (If I'm not mistaken this
would return 0 rows if no records were inserted on a Sunday).  

 

Does MySQL include a specifier for business day?   

 

Thank you, 

Michael 

Reply via email to