Great! Glad I asked the question.
Shawn Bauer wrote:
Adding indexes to PlyrID and StartGaming did the trick. Took about 30
min
but it ran and didn't take 14 hours
--
Thanks - Shawn
:
They are not indexed. Don't know much about indexes other then when
I query
our SMS Host database which is FoxPro it has indexes for all tables.
The
table with 6.2M records is pulled from another database. We can't
run
queries on live data on this database export required data to Access
to run
reports. So, if I index StartGaming and PlyrID maybe it will run
more
efficiently? Even if it took 4-6 hours, I need the data once. I'll
probably write macro to select and analyze a sub-set of the records
and
append results to new table until all are complete.
Thanks for your help. I am not very experienced with Access, just
figure
out how to accomplish what ever needs arise.
--
Thanks - Shawn
:
Are the StartGaming and PlyrID fields indexed? That would help
performance
significantly. With 6.2 million records, this may not run in
Access.
As far as increasing the MaxLocksPerFile Registry entry, I can't
give you any
advice at this point. I am using an Apple Mac right now and ...
Shawn Bauer wrote:
The query below worked perfect on a test table of 4,000 records
but when I
ran it on actual table of 6,200,000 records it was still grinding
away 15
hours later :-(
SELECT T.*
FROM StatTrip1 AS T
WHERE (((T.StartGaming) In (SELECT TOP 10 X.StartGaming
FROM StatTrip1 as X
WHERE X.PlyrID = T.PlyrID
ORDER BY X.StartGaming DESC)));
This will not be run frequently but I need to determine how many
player
accounts meet certain criteria over there last 10 visits before
we implement
on floor. So, I tried brute force and created table sorted by
combined field
PlyrID-Date. I then add autonumber and call it TripID and
calcualate a
TripCount by PlyrID where [TripCnt] = [TripIDmax]-[TripID]+1.
Problem is
that Access won't let me add an autonumber to a table this large
giving error
message "File sharing lock exceeded. Increase MaxLocksPerFile
registry
entry." How do I do this?
--
Thanks - Shawn
:
Coordinated subquery is the answer. This should work for you,
BUT it could be slow.
SELECT T.*
FROM YourTable as T
WHERE T.TransDate IN
(SELECT TOP 10 X.TransDate
FROM YourTable as X
WHERE X.UserID = T.UserID
ORDER BY X.TransDate DESC)
Shawn wrote:
I have a large database each record includes fields for
UserID and TransDate.
I would like to select the last 10 records (by TransDate)
for each UserID.
If I could just Number or Count the records for each USerID
then I can select
by <=10. I can use running sum in report but would like to
do this via query.
Thanks - Shawn