简体   繁体   中英

getting listed date between two dates excluding weekends in mysql

I'm trying to make a program using c# winform. I am strugggling with handling database. I am trying to get all the dates between two dates excluding weekends. For example result should be like this:

2019-07-01 ~ 2019-07-10

2019-07-01

2019-07-02

2019-07-03

2019-07-04

2019-07-05

2019-07-08

2019-07-09

2019-07-10

2019-07-06 and 2019-07-07 shouldn't be printed because it is saturday and sunday.

Trying to get date from LAB_SDATE and LAB_EDATE from the table shown below.

I want to add listed dates in to another Table. 在此处输入图片说明

Try this

SELECT datecolumn 
FROM table 
WHERE WEEKDAY(datecolumn)<5;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM