6 Replies Latest reply: Apr 5, 2013 11:05 AM by Aio Aio RSS

    Having Min(time)

    Aio Aio

      Hi,

      I have to add a new flag field to a table

      I got a table with

      date,who,place,Time,key,Type.

       

      I'd like to add 'like 'First_appointment'.' which could be true or false

      It should mean:

      In the day 13/01/2012 in the place A, which is the first appointment of that day in that place?

       

      In oracle you should do smt like:

       

       

      select a.date,a.where,a.key,1 as First_appointment

      from TAB a

      where not exists (select 1 from TAB b where a.date=b.date and a.place = b.place and b.time >a.time)

       

       

      Do you think you can handle it?

       

      many thanks