PC Review


Reply
Thread Tools Rate Thread

complicated date issue

 
 
pat67
Guest
Posts: n/a
 
      23rd Feb 2011
Hi, here is my issue. I have a table with dates and part numbers on
it. It is a table I append each week with what is on the report I am
uploading. What I am looking for is to see how long parts have been on
the list. The problem is a part may be on the list this week, off the
list next week and then on the list for 4 weeks after. I can't do a
simple min for the date because that would give me this week. What I
am looking for is how many current consecutive weeks the part has been
on and when the first week was of the current weeks list. Any ideas?

Thanks
 
Reply With Quote
 
 
 
 
John Spencer
Guest
Posts: n/a
 
      24th Feb 2011
This may get you started on identifying where the breaks occur. It is
untested, but it may give you an idea.

SELECT A.PartNumber, A.ActiveDate
, Max(B.ActiveDate) as PriorDate
FROM TheList As A LEFT JOIN TheList As B
ON A.PartNumber = B.PartNumber
AND A.ActiveDate > B.ActiveDate
GROUP BY A.PartNumber, A.ActiveDate
HAVING A.ActiveDate -7 < Max(B.ActiveDate)


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 2/23/2011 2:46 PM, pat67 wrote:
> Hi, here is my issue. I have a table with dates and part numbers on
> it. It is a table I append each week with what is on the report I am
> uploading. What I am looking for is to see how long parts have been on
> the list. The problem is a part may be on the list this week, off the
> list next week and then on the list for 4 weeks after. I can't do a
> simple min for the date because that would give me this week. What I
> am looking for is how many current consecutive weeks the part has been
> on and when the first week was of the current weeks list. Any ideas?
>
> Thanks

 
Reply With Quote
 
pat67
Guest
Posts: n/a
 
      24th Feb 2011
On Feb 24, 8:38*am, John Spencer <JSPEN...@Hilltop.umbc> wrote:
> This may get you started on identifying where the breaks occur. *It is
> untested, but it may give you an idea.
>
> SELECT A.PartNumber, A.ActiveDate
> , Max(B.ActiveDate) as PriorDate
> FROM TheList As A LEFT JOIN TheList As B
> ON A.PartNumber = B.PartNumber
> AND A.ActiveDate > B.ActiveDate
> GROUP BY A.PartNumber, A.ActiveDate
> HAVING A.ActiveDate -7 < Max(B.ActiveDate)
>
> John Spencer
> Access MVP 2002-2005, 2007-2010
> The Hilltop Institute
> University of Maryland Baltimore County
>
> On 2/23/2011 2:46 PM, pat67 wrote:
>
>
>
> > Hi, here is my issue. I have a table with dates and part numbers on
> > it. It is a table I append each week with what is on the report I am
> > uploading. What I am looking for is to see how long parts have been on
> > the list. The problem is a part may be on the list this week, off the
> > list next week and then on the list for 4 weeks after. I can't do a
> > simple min for the date because that would give me this week. What I
> > am looking for is how many current consecutive weeks the part has been
> > on and when the first week was of the current weeks list. Any ideas?

>
> > Thanks- Hide quoted text -

>
> - Show quoted text -


ok let me check it out. thanks
 
Reply With Quote
 
pat67
Guest
Posts: n/a
 
      24th Feb 2011
On Feb 24, 8:38*am, John Spencer <JSPEN...@Hilltop.umbc> wrote:
> This may get you started on identifying where the breaks occur. *It is
> untested, but it may give you an idea.
>
> SELECT A.PartNumber, A.ActiveDate
> , Max(B.ActiveDate) as PriorDate
> FROM TheList As A LEFT JOIN TheList As B
> ON A.PartNumber = B.PartNumber
> AND A.ActiveDate > B.ActiveDate
> GROUP BY A.PartNumber, A.ActiveDate
> HAVING A.ActiveDate -7 < Max(B.ActiveDate)
>
> John Spencer
> Access MVP 2002-2005, 2007-2010
> The Hilltop Institute
> University of Maryland Baltimore County
>
> On 2/23/2011 2:46 PM, pat67 wrote:
>
>
>
> > Hi, here is my issue. I have a table with dates and part numbers on
> > it. It is a table I append each week with what is on the report I am
> > uploading. What I am looking for is to see how long parts have been on
> > the list. The problem is a part may be on the list this week, off the
> > list next week and then on the list for 4 weeks after. I can't do a
> > simple min for the date because that would give me this week. What I
> > am looking for is how many current consecutive weeks the part has been
> > on and when the first week was of the current weeks list. Any ideas?

>
> > Thanks- Hide quoted text -

>
> - Show quoted text -


I am going to have to wait until next week when i have 3 dates. with
only 2 right now, the qry returns blanks.
 
Reply With Quote
 
pat67
Guest
Posts: n/a
 
      24th Feb 2011
On Feb 24, 10:04*am, pat67 <pbus...@comcast.net> wrote:
> On Feb 24, 8:38*am, John Spencer <JSPEN...@Hilltop.umbc> wrote:
>
>
>
>
>
> > This may get you started on identifying where the breaks occur. *It is
> > untested, but it may give you an idea.

>
> > SELECT A.PartNumber, A.ActiveDate
> > , Max(B.ActiveDate) as PriorDate
> > FROM TheList As A LEFT JOIN TheList As B
> > ON A.PartNumber = B.PartNumber
> > AND A.ActiveDate > B.ActiveDate
> > GROUP BY A.PartNumber, A.ActiveDate
> > HAVING A.ActiveDate -7 < Max(B.ActiveDate)

>
> > John Spencer
> > Access MVP 2002-2005, 2007-2010
> > The Hilltop Institute
> > University of Maryland Baltimore County

>
> > On 2/23/2011 2:46 PM, pat67 wrote:

>
> > > Hi, here is my issue. I have a table with dates and part numbers on
> > > it. It is a table I append each week with what is on the report I am
> > > uploading. What I am looking for is to see how long parts have been on
> > > the list. The problem is a part may be on the list this week, off the
> > > list next week and then on the list for 4 weeks after. I can't do a
> > > simple min for the date because that would give me this week. What I
> > > am looking for is how many current consecutive weeks the part has been
> > > on and when the first week was of the current weeks list. Any ideas?

>
> > > Thanks- Hide quoted text -

>
> > - Show quoted text -

>
> ok let me check it out. thanks- Hide quoted text -
>
> - Show quoted text -


Ok. I added data to make 3 sets of dates. I ran the query and what I
see is where a part is on the first week, then not the second, but
then again on the third, it shows twice like this

Part Date Prior Date
123 2/14/11 3/1/11
123 3/1/11 3/1/11


What I am looking for is for it to show like this

Part Earliest Date
123 3/1/11


meaning even though this part was on the 2/14 report, it wasn't on
2/22 report and thus is new for 3/1. So if it were on 3/8, 3/15 and
3/22, i would see 3/1 as the earliest date. If in fact it came off and
was not back on until the 3/22 report, the the date i would see is
3/22

Am i explaining it clearly? I know what I mean I am trying to convey
it properly.

Thanks



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
complicated date issue pat67 Microsoft Access Queries 0 23rd Feb 2011 07:59 PM
Complicated replacement values in list issue CompleteNewb Microsoft Excel Programming 2 12th Mar 2008 06:58 AM
Need Help on this complicated issue - VBA and the API to Dynamically Set Screen and Window Sizes willjohnson33@yahoo.com Microsoft Excel Programming 2 10th Nov 2006 08:01 PM
EFS issue...somewhat complicated Roger Windows XP Security 2 29th Mar 2006 01:35 PM
Complicated issue re 'Type mismatch in JOIN expression' =?Utf-8?B?QWRhbQ==?= Microsoft Access 10 14th Jun 2004 09:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:19 PM.