- Jun 13, 2000
- 26,391
- 1,780
- 126
I've got a reporting tool that allows me to write SQL queries. It has an option to set dynamic variables by writing sql code to dynamically grab dates, etc.. One example is, it could grab today's date, convert to a string, then use substring functions to create a date code to use in the primary query.
Can you do anything like this in mySQL? I'm new to writing reports outside of the reporting tool. What I'm struggling with is that I have a database with date codes that splits the year in half. Basically first half and second half of the year. For 2016, it'd be like 20161 and 20167, 20171 and 20177... What I need to do is be able to write queries that look at a date code and use the previous date code on a separate table to look up prior history. (that's they dynamic part)
Can you do anything like this in mySQL? I'm new to writing reports outside of the reporting tool. What I'm struggling with is that I have a database with date codes that splits the year in half. Basically first half and second half of the year. For 2016, it'd be like 20161 and 20167, 20171 and 20177... What I need to do is be able to write queries that look at a date code and use the previous date code on a separate table to look up prior history. (that's they dynamic part)