dbTalk Databases Forums  

Last 12 months with same date

comp.database.oracle comp.database.oracle


Discuss Last 12 months with same date in the comp.database.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
captain
 
Posts: n/a

Default Last 12 months with same date - 07-09-2004 , 05:00 AM






Below is the sql for data with same date need
to extract + or - 5 days data of same date also.

How to also get data of + and - days related to same date.


SELECT IM.Area,
IM.Location,
IT.itemid,
IT.date,
IT.Qty,
IT.Rate,
IT.Amount
FROM ITran as IT
INNER JOIN
IMast as IM
ON IT.itemid = IM.itemid
WHERE IT.itemid="A101"
and (IT.date='01DEC2003'd
or IT.date='01DEC2003'd-30
or IT.date='01DEC2003'd-61
or IT.date='01DEC2003'd-91
or IT.date='01DEC2003'd-122
or IT.date='01DEC2003'd-153
or IT.date='01DEC2003'd-183
or IT.date='01DEC2003'd-214
or IT.date='01DEC2003'd-244
or IT.date='01DEC2003'd-275
or IT.date='01DEC2003'd-303
or IT.date='01DEC2003'd-334
or IT.date='01DEC2003'd-365)
order by IM.Area, IT.itemid, IT.date desc;
quit;

Captain

Reply With Quote
  #2  
Old   
Michael J. Moore
 
Posts: n/a

Default Re: Last 12 months with same date - 07-11-2004 , 11:05 PM






BETWEEN

"captain" <captain_2010 (AT) yahoo (DOT) com> wrote

Quote:
Below is the sql for data with same date need
to extract + or - 5 days data of same date also.

How to also get data of + and - days related to same date.


SELECT IM.Area,
IM.Location,
IT.itemid,
IT.date,
IT.Qty,
IT.Rate,
IT.Amount
FROM ITran as IT
INNER JOIN
IMast as IM
ON IT.itemid = IM.itemid
WHERE IT.itemid="A101"
and (IT.date='01DEC2003'd
or IT.date='01DEC2003'd-30
or IT.date='01DEC2003'd-61
or IT.date='01DEC2003'd-91
or IT.date='01DEC2003'd-122
or IT.date='01DEC2003'd-153
or IT.date='01DEC2003'd-183
or IT.date='01DEC2003'd-214
or IT.date='01DEC2003'd-244
or IT.date='01DEC2003'd-275
or IT.date='01DEC2003'd-303
or IT.date='01DEC2003'd-334
or IT.date='01DEC2003'd-365)
order by IM.Area, IT.itemid, IT.date desc;
quit;

Captain



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.