Monday, March 12, 2012

Qry with "OR" keyword assistance...

Is there a better more reliable or eaiser way to get what I'm looking for?
I want anything that was created after Jan. 1, 2003 that was declined, the
declined letter codes are as indicated, and created after Jan 1, 2003
Or, I want anything that was rated and created after Jan 1, 2003
Or, I want anything that was paid and created after Jan 1, 2005 and
(redundently) created after Jan 1, 2003
Or that was recently created in the most recent campaign occuring Sept 1, 20
05
and (redundently) created after Jan 1, 2003
where (c2.ltrcode in('4','13,'16')
or (c2.rated > '0')
or (isdate(c2.upremrecd = 1 and c1.createdt > '20050101')
or c1.createdt > '20050901')
and c1.createdt > '20030101'
TIA
JeffP...if you find this running slowly, you can use UNIONs to pull them all
together, e.g.
select <colum list>
from <tables>
where c1.createdt > '20030101'
and c2.ltrcode in ('4','13','16')
union
select <colum list>
from <tables>
where c1.createdt > '20030101'
and c2.rated > '0'
union
<etc>
JDP@.Work wrote:
> Is there a better more reliable or eaiser way to get what I'm looking for?
> I want anything that was created after Jan. 1, 2003 that was declined, the
> declined letter codes are as indicated, and created after Jan 1, 2003
> Or, I want anything that was rated and created after Jan 1, 2003
> Or, I want anything that was paid and created after Jan 1, 2005 and
> (redundently) created after Jan 1, 2003
> Or that was recently created in the most recent campaign occuring Sept 1,
2005
> and (redundently) created after Jan 1, 2003
> where (c2.ltrcode in('4','13,'16')
> or (c2.rated > '0')
> or (isdate(c2.upremrecd = 1 and c1.createdt > '20050101')
> or c1.createdt > '20050901')
> and c1.createdt > '20030101'
> TIA
> JeffP...
>

No comments:

Post a Comment