Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Demo
CREATE TABLE tbl_date1 ( date_str DATETIME, int_add INT ); INSERT INTO tbl_date1 (date_str, int_add) VALUES ('2016-12-01 00:00:00',5), ('2016-12-02 00:00:00',2), ('2016-12-04 00:00:00',4); CREATE TABLE tbl_date2 ( date_bpass DATETIME ); INSERT INTO tbl_date2 (date_bpass) VALUES ('2016-12-03 00:00:00'), ('2016-12-04 00:00:00') SELECT date_str, int_add, Dateadd(dd, int_add + add_count, date_str) FROM tbl_date1 a OUTER apply (SELECT Count(1) FROM tbl_date2 b WHERE b.date_bpass BETWEEN Dateadd(dd, 1, a.date_str) AND Dateadd(dd, a.int_add, a.date_str)) cs (add_count)
run
|
edit
|
history
|
help
0
SQL HW 1 Appline
T-SQL CRUD procedures auto-generator
FIGURA5.4
Demo
begginer1
a
Insert index into Temporary Table
Get all dates between two given dates
bc160400784
mysql4