Select MAX(CONTRACT_END-CONTRACT_START), JOB_DESC, EMP_NAME FROM CONTRACT join JOB on CONTRACT_JOB = JOB_ID join EMPLOYER on CONTRACT_CLIENT = EMP_ID WHERE CONTRACT_END is not NULL GROUP BY JOB_ID,JOB_DESC,EMP_NAME
This query currently outputs:
MAX(CONTRACT_END-CONTRACT_START) JOB_DESC EMP_NAME -------------------------------- --------------- ------------------------------ 153 Red Mage Archadian Judges 80 Army Archadian Judges 119 UNDEFINED Strife Delivery Service 290 UNDEFINED Archadian Judges 89 Pilot AVALANCHE 119 Bar Staff AVALANCHE 232 Monk AVALANCHE 340 Army Kingsglaive
I want the output to be:
MAX(CONTRACT_END-CONTRACT_START) JOB_DESC EMP_NAME -------------------------------- --------------- ------------------------------ 340 Army Kingsglaive
That's why I used max() but I can't figure out why it's not just showing the max value. I am very new to SQL
https://stackoverflow.com/questions/65432734/how-do-i-make-max-function-only-out-put-a-single-row December 24, 2020 at 08:58AM
没有评论:
发表评论