sql - MySQL select max date or null date -
I want to select the maximum date or zero but it shows an error message.
Error: SQLCODE = -104, SQLSTATE = 42601, SQLERRMC = IS;, case when MAX (date; conak, driver = 3.64.114)
Original table is
Employee code should resign date 001 1/2/2013 001 1/5/2014 001 tap 002 10/10/2000
EMPLOYEE_CODE RESIGNATION_DATE 001 False 002 10/10/2000
This is my query
SELECT EMPLOYEE_CODE, in case When MAX (RESIGNATION_DATE IS is NULL) = 0 THEN MAX (RESIGNATION_DATE) by END as the date received from the EMALOMEECOCONTRACT group;
Can anyone locate any problem? Thanks < p>
Can anyone figure out the problem?
Condition in:
Maximum (RESIGNATION_DATE IS NULL) = 0
You have
MAX >> as
RESIGNATION_DATE is NULL
Your query should be:
select emp_code, res_da, select / em, first select zero emp_code * where res_date emp_code select UNION emp_code, MAX ( res_date) by maximum group * / select from maximum non-zero emp_code * / from Table_name where emp_code is not (select emp_code Table_name where res_date IS NULL) group emp_code Select Select emp_code, MAX (res_date) / * non-empty emp_code * from / max selection * to / table_name where emp_code is not in (table_name from emp_code where res_date is is null) group emp_code < / div>
Comments
Post a Comment