Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 30th, 2003, 01:51 AM
mis_bzu mis_bzu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 mis_bzu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Select the lowest value field record from consecutive records

Respected Sir,
I have designed a query in MS Access 2000 that is based on following fields of underlying tables.

ExchangeCode
TelephoneNo
PayableBill
CurrentMonth
PreviousRepeatedMonth

This query fetches the following data.

Exchange Telephone Payable Current PreviousRepeated
Code No Bill Month Month
-------- --------- ------- ------- ----------------
101 500000 10.00 10/2003 06/2003
101 500000 10.00 10/2003 08/2003
101 500000 10.00 10/2003 09/2003
101 500000 10.00 10/2003 10/2003
101 500001 10.00 10/2003 04/2003
101 500001 10.00 10/2003 05/2003
101 500001 10.00 10/2003 07/2003
101 500001 10.00 10/2003 09/2003
101 500001 10.00 10/2003 10/2003


Now the problem is that I want to dispaly only that record from
the above mentioned recordset that has a smallest value in the
PreviousRepeatedMonth field in consecutive records starting from
currentmonth value in the previousRepeatedMonth field for each
telephone number. So according to this criteria only following
rows of above mentioned recordset should be displayed in the
report that I ha ve generated in access..

Exchange Telephone Payable Current PreviousRepeated
Code No Bill Month Month
-------- --------- ------- ------- ----------------
101 500000 10.00 10/2003 08/2003
101 500001 10.00 10/2003 09/2003

So kindly help me what I shall have to do to achieve my this
objective. I shall be grateful to you.
Thanks in advance.

Nadeem.

Reply With Quote
  #2  
Old November 30th, 2003, 10:31 PM
BlueGazoo BlueGazoo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: TO
Posts: 17 BlueGazoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SELECT tblAccount.code, tblAccount.phone, tblAccount.bill, tblAccount.date1, First(tblAccount.date2) AS FirstOfdate2
FROM tblAccount
GROUP BY tblAccount.code, tblAccount.phone, tblAccount.bill, tblAccount.date1
ORDER BY First(tblAccount.date2)

But hold on a second...

Quote:
Now the problem is that I want to dispaly only that record from the above mentioned recordset that has a smallest value in the
PreviousRepeatedMonth field


That means you the earliest date (i.e. smallest) for each account number (phone number)?

Im not sure im understanding correctly what you're trying to do...

Last edited by BlueGazoo : November 30th, 2003 at 10:41 PM.

Reply With Quote
  #3  
Old December 4th, 2003, 02:02 AM
mis_bzu mis_bzu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 2 mis_bzu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Blue Gazoo for your kind reply. Dear problem is not to just select the smallest value of second date field, but it is to select the only that record which has the smallest value on second date field in the recent consecutive dates. That's why I have illustrated the said situation with the help of example data. I can do it in Oracle, SQL Server or Access projects with the help of Procedure and Cursor. But as the database is in MS Access 2000 so I don't know how I shall have to achieve this objective. So in this regard if you have any solution then I shall be grateful to you.
Thanks again for kind reply.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Select the lowest value field record from consecutive records


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway