devendra devendra - 1 year ago 120
MySQL Question

How to find min in time and max out time from table using MySQL query

I have a MySQL Table. I need to find MIN IN TIME AND MAX OUT TIME using MySQL.

enter image description here

Answer Source

A unique column for the H24 time it would be better..but do the actual column you could use

select min( case when in_am is null then in_pm else in_am end) as min_in,
       max( case when out_pm is null then out_am else iout_pm end) as max_out
from my_table;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download