between-consider closing date??

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

Poston Thu, 02 Feb 2006 8:18 am

Hello Guys.

I have the following query:
Code: Select all
select t.trx_number,
         t.lote,
         t.venda_pax,
         t.venda_comissao,
         l.valor_lote,
         l.data,
         l.qtd_lancamentos
from
        bx_tbl_transacao t inner join bx_tbl_lote l
        on (t.lote = l.lote)
where
       data between '31/01/2006' and '02/02/2006'
the problem is as follows, the query only returns the data of the day 31/01 and 01/02, I need q return also the data of the day 02/02.

Note date field in the table is timestamp.

Someone help me??

Thankfully, Kamal
izaura
Location: santos-sp

Poston Fri, 03 Feb 2006 9:02 am

This is because the date have hour and minute, IE is greater than 2/2/2006. Normally, I don't use the between, I put as follows:
Code: Select all
select t.trx_number,
         t.lote,
         t.venda_pax,
         t.venda_comissao,
         l.valor_lote,
         l.data,
         l.qtd_lancamentos
from
        bx_tbl_transacao t inner join bx_tbl_lote l
        on (t.lote = l.lote)
where data >=to_date('31/01/2006', 'dd/mm/rrrr')
  and data < to_date('02/02/2006', 'dd/mm/rrrr') + 1
:-
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Thu, 09 Feb 2006 4:19 pm

Thank you very much.
izaura
Location: santos-sp

Poston Sat, 11 Feb 2006 3:45 pm

You can use trunc date too!

I Went.

Maia.
fmaia
Location: SP

Fmaia - Oracle Developer


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests