sql - Select a timestamp when I have only a date? -
i have table has 2 columns of timestamp datatype, start_time
, end_time
. format '2013-5-19 09:00:00'.
when user enter date, 2013-5-19. how largest value date user has entered?
select max(end_time) appointment ...
you should max(end_time)
, records within given date.
here's working sql fiddle.
or can try this:
create table appointment(start_time date, end_time date); insert appointment(start_time, end_time) values (to_date('2013-5-19 09:00:00', 'yyyy-mm-dd hh24:mi:ss'), to_date('2013-5-19 11:00:00', 'yyyy-mm-dd hh24:mi:ss')); select start_time, end_time appointment; select max(end_time) appointment to_char(end_time,'yyyy-mm-dd')= to_char(to_date('2013-5-19', 'yyyy-mm-dd'),'yyyy-mm-dd');
Comments
Post a Comment