Welcome Guest, Not a member yet? Register   Sign In
How to show date rows equals current date?
#31

(This post was last modified: 03-07-2019, 07:21 AM by php_rocs.)

@jelz2018,

We're in the home stretch.  I'm definitely awake now after a good nights rest (I was starting to run on fumes).  Ok, I see what the issue was, I had one to many parenthesis.

Here you go...

Code:
select count(employee_id) as count
from (
select employee_id,year,month,
  case when LOCATE('-',multiple) > 0 then substring(multiple,1,locate('-',multiple) - 1)
  else multiple end as 1st_date,
  case when LOCATE('-',multiple) > 0 then substring(multiple,locate('-',multiple) + 1,length(multiple) - locate('-',multiple))
  else multiple end as 2nd_date
from ats_leave_apps
) as d
where curdate() between (DATE(concat(year,'-',month,'-',1st_date)) - INTERVAL 1 DAY) and (DATE(concat(year,'-',month,'-',2nd_date))
+ INTERVAL 1 DAY)

I fixed the previous code too.
Reply


Messages In This Thread
RE: How to show date rows equals current date? - by php_rocs - 03-07-2019, 07:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB