Home » SQL & PL/SQL » SQL & PL/SQL » how to combine the conditions
how to combine the conditions [message #245834] Mon, 18 June 2007 23:55 Go to next message
msg2ajay
Messages: 51
Registered: June 2007
Location: KUALA LUMPUR
Member
hello ,
The below is the sql statement in which is it possible to reduce the last two conditons. that is

select a.name,a.prodcd,a.icno,a.curcd,b.txamt,a.paytyp,b.txday
from ifmr a, globtab g, ifschd b
where b.type='S'
and crdb='2'
and to_date(b.txday,'YYYYMMDD')> (to_date(g.globtab_tbsdy,'YYYYMMDD'))
and to_date(b.txday,'YYYYMMDD')<= (to_date(g.globtab_tbsdy,'YYYYMMDD')+3);



thx & rgds,
Ajay
Re: how to combine the conditions [message #245849 is a reply to message #245834] Tue, 19 June 2007 00:51 Go to previous messageGo to next message
Michel Cadot
Messages: 64153
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you mean with only one operator:

to_date(b.txday,'YYYYMMDD')
between
to_date(g.globtab_tbsdy,'YYYYMMDD') + 1/86400
and
to_date(g.globtab_tbsdy,'YYYYMMDD')+3

But I don't see the advantage.

Regards
Michel
Re: how to combine the conditions [message #245860 is a reply to message #245849] Tue, 19 June 2007 01:42 Go to previous messageGo to next message
msg2ajay
Messages: 51
Registered: June 2007
Location: KUALA LUMPUR
Member
yaa there is no difference but as the folowing bolded was using twice so i thik is there any method to combine the below code.

to_date(b.txday,'YYYYMMDD')> (to_date(g.globtab_tbsdy,'YYYYMMDD'))
and to_date(b.txday,'YYYYMMDD')<= (to_date(g.globtab_tbsdy,'YYYYMMDD')+3);


thx & rgds,
Ajay
Re: how to combine the conditions [message #245883 is a reply to message #245860] Tue, 19 June 2007 02:57 Go to previous messageGo to next message
Michel Cadot
Messages: 64153
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
to_date(b.txday,'YYYYMMDD')
between
to_date(g.globtab_tbsdy,'YYYYMMDD') + 1/86400
and
to_date(g.globtab_tbsdy,'YYYYMMDD')+3

The bold section is only once.
But there is no difference as Oracle internally changes it to an AND.

Regards
Michel
Re: how to combine the conditions [message #245885 is a reply to message #245883] Tue, 19 June 2007 02:59 Go to previous message
msg2ajay
Messages: 51
Registered: June 2007
Location: KUALA LUMPUR
Member
thank u very much...
that's it.

rgds,
Ajay

[Updated on: Tue, 19 June 2007 02:59]

Report message to a moderator

Previous Topic: logging
Next Topic: Need help
Goto Forum:
  


Current Time: Sun Dec 11 00:32:26 CST 2016

Total time taken to generate the page: 0.04827 seconds