|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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:
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. |
|
#3
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Select the lowest value field record from consecutive records |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|