0

I have a database table that constantly getting data, more specifically every 30s. I need to select data in user specified days range. For example from 30 days in the past till now and it would return data even if there is no results available.

My table structure:

id | timstamps | io_a | io_b |
______________________________ 
1 | 2016-12-20 09:50:44| 1 | 0 |

For example i need to select from 2016-11-21 till today - 2016-12-20 and that i would get results even if there is no results.

Example:

2016-12-01 08:50:34
2016-12-02 08:50:34
2016-12-03 08:50:34
etc. till
2016-12-20 09:50:44

SOLVED:

used this query and it worked.

SELECT * FROM table WHERE timestamps > :laikasn AND timestamps < NOW()
ORDER BY timestamps
arnas120
  • 23
  • 4

0 Answers0