Return No of rows as Days in between |
04-13-2022, 02:32 AM
(This post was last modified: 04-13-2022, 02:48 AM by lazyme114. Edit Reason: update )
Hi all, I am doing something like this:-
PHP Code: $query = $this->db->where(array( It is working fine. But I want it to return a single row for each days between start and end even if data doesn't exists.
Found New Way
PHP Code: SELECT * FROM bf_attendance where checkin > 2022-03-15 - interval 1 month but still if no data no row..
You can't pull data from MySQL which doesn't exist. If it's that important I would loop through the returned data and add a blank record/object/array when I find an empty date,
(04-13-2022, 01:51 PM)JustJohnQ Wrote: You can't pull data from MySQL which doesn't exist. If it's that important I would loop through the returned data and add a blank record/object/array when I find an empty date, Currently, I am doing exactly that but, Its for a monthly report and I have to loop through employee first then the sql query comes. If I have 30 employee I have to run 900 query in average. So you see my problem right. I want something that will take less time and load faster. |
Welcome Guest, Not a member yet? Register Sign In |