doubt with DATE

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

Poston Thu, 03 Apr 2008 3:52 pm

Guys IM with a SQL problem good at Bd have a time field that the hours are recorded until 00:00 normal 23:59 the problem is that if I do a select to get all ´ ID's between 22:00 he 06:00 will return until the 23:00 porque?

He can't catch up to 06:00 in the morning?
carlos12
Location: rio

Poston Thu, 03 Apr 2008 4:01 pm

I went through this same question today.

Remember that date format columns, have several attributes such as weekday, seculo, month name, where you access them by a mask for the required attribute.

so you know which ID's there are in these times you must make between days until the time
Code: Select all
where coluna_data betwen to_date('03/04/2008 22:00','DD/MM/RRRR HH24:MI') and to_date('04/04/2008 06:00','DD/MM/RRRR HH24:MI')
or put two one of the 22:00 betwen 23:59 and another of 00:00 the 06:00.
Code: Select all
where
       coluna_data betwen to_date('22:00','HH24:MI') and to_date('23:59','HH24:MI')
and coluna_data betwen to_date('00:00','HH24:MI') and to_date(06:00,'HH24:MI')
any doubt ... we're there.
alef
Location: Patos de Minas - MG

Alexandre Matos
Patos de Minas - MG
Do interior de Minas para o resto do Mundo

Poston Thu, 03 Apr 2008 4:44 pm

NICE GAVE CERTINHO ALEF THANKS!!
carlos12
Location: rio


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests