Re: selecting records based on the position in the database
From: Jo (anonymous_at_discussions.microsoft.com)
Date: 09/29/04
- Next message: viv: "How do you double indent?"
- Previous message: LightShow: "Need help comparing two tables"
- In reply to: Michel Walsh: "Re: selecting records based on the position in the database"
- Next in thread: Michel Walsh: "Re: selecting records based on the position in the database"
- Reply: Michel Walsh: "Re: selecting records based on the position in the database"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 28 Sep 2004 23:38:38 -0700
Thank you for your help.
The top values won't work because i need to retrieve all
records in groups of 15. (there are very many records).
Unfortunatley i am a novice in the query writing dept and
wonder if you could expand further with regards
to "ranking" my records
The table is called a Records with the following relevant
fields; i have added the date/time field as recommended
thanks -
Date/Time
Reference
Amount
I am using Access 97.
Hope you don't mind helping further
Thanks
>-----Original Message-----
>Hi,
>
>
>You have a date time stamp field?
>
>
>SELECT TOP 15 *
>FROM myTable
>ORDER BY dateTime DESC;
>
>
> supply the latest 15. Otherwise, rank your records:
>
>
>SELECT LAST(a.f1), LAST(a.f2), LAST(a.f3), ... , LAST
(a.fn), a.dateTime
>FROM myTable As a INNER JOIN myTable As b
> ON a.dateTime <= b.dateTime
>GROUP BY a.dateTime
>HAVING COUNT(*) BETWEEN 46 AND 60
>
>
>as example.
>
>That assumes you don't have two records with the same
dateTime value, and no
>null values, ie. that dateTime can be a primary key.
>
>
>Hoping it may help,
>Vanderghast, Access MVP
>
>
>
>"Jo" <anonymous@discussions.microsoft.com> wrote in
message
>news:030e01c4a596$c357dfd0$a401280a@phx.gbl...
>>I wonder if someone can help me please.
>>
>> I need to write a query for a database that needs to
>> produce regular reports based on the latest records in
the
>> database (records are frequently added and deleted and
>> therefore the query cannot be based on the ID). The
>> records are to be grouped 15 at a time. The database
will
>> be operated by someone other than myself and therefore
>> needs to do the process automatically. Quite simply i
just
>> want to select the first 15 records, the next 15 and so
on.
>> Can anyone help please
>
>
>.
>
- Next message: viv: "How do you double indent?"
- Previous message: LightShow: "Need help comparing two tables"
- In reply to: Michel Walsh: "Re: selecting records based on the position in the database"
- Next in thread: Michel Walsh: "Re: selecting records based on the position in the database"
- Reply: Michel Walsh: "Re: selecting records based on the position in the database"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|