Created
June 20, 2017 08:46
-
-
Save Trshant/f03ffdcfafc40e934a48e2cd3af0e5eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM (select * from | |
(select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date from | |
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0, | |
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1, | |
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2, | |
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3, | |
(select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t4) v | |
where selected_date between '2012-01-1' and '2012-05-15')x WHERE DATE_FORMAT( x.selected_date , '%w' ) = 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ( | |
t4.i *10000 + t3.i *1000 + t2.i *100 + t1.i *10 + t0.i | |
)selected_date | |
FROM ( | |
SELECT 0 i | |
UNION SELECT 1 | |
UNION SELECT 2 | |
)t0, ( | |
SELECT 0 i | |
UNION SELECT 1 | |
UNION SELECT 2 | |
)t1, ( | |
SELECT 0 i | |
UNION SELECT 1 | |
UNION SELECT 2 | |
)t2, ( | |
SELECT 0 i | |
UNION SELECT 1 | |
UNION SELECT 2 | |
)t3, ( | |
SELECT 0 i | |
UNION SELECT 1 | |
UNION SELECT 2 | |
)t4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment