Doubt SQL command

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc

Poston Tue, 30 Oct 2007 4:50 pm

I'vê got a bank that holds the entry and exit times of doctors in a hospital.
Need to get the range of these schedules 2 and offers them 30 in 30 minutes ... I don't have the slightest idea of how to do this, who can help I appreciate and ...
Location: Sao Paulo SP

Poston Tue, 30 Oct 2007 7:01 pm

I have no way to test at the moment, you could do something like:
Code: Select all
select data_hora_intervalo
   select a.data_entrada + (b.rnum / 48)
   from  tabela_entrada_saida a
       , (
           select level rnum
           from dual connect by
           level <= (
                      select (nvl(dat_saida, sysdate) - dat_entrada) * 48
                      from   tabela_entrada_saida
                      where  id_medico = 1
         ) b
   where a.id_medico = 1
IE, you need to add n * (1/48) (1 day = 12:0 am, multiplied by 2 because the range should be every half hour) day at time of entry, where n would range from 1 to the number of intervals of 30 minutes between the input and output of the doctor (which is what the select from dual doing here).
Location: Londrina - PR

Rafael O. Genaro

  • See also
    Last Post

      Return to SQL

      Who is online

      Users browsing this forum: Google [Bot] and 5 guests