Groups | Blog | Home
all groups > inetserver asp general > october 2004 >

inetserver asp general : rolling last 10?



dlbjr
10/31/2004 9:57:50 AM
Are you storing a date time stamp with the ID in the table when they visit the site?

If so:

Lets say the table fields are like so in a table named VISIT:

VSTAMP | ID

Then this query will get what you want

SELECT TOP 10 ID
FROM VISIT
GROUP BY ID
ORDER BY Max(VDATE) DESC;

or

SELECT TOP 15 ID
FROM VISIT
GROUP BY ID
ORDER BY Max(VDATE) DESC;

'dlbjr
'Pleading sagacious indoctrination!

dlbjr
10/31/2004 10:08:21 AM
'recall - had a typo on field name VSTAMP in SQL statements - shit happens!

VSTAMP | ID

Then this query will get what you want

SELECT TOP 10 ID
FROM VISIT
GROUP BY ID
ORDER BY Max(VSTAMP) DESC;

or

SELECT TOP 15 ID
FROM VISIT
GROUP BY ID
ORDER BY Max(VSTAMP) DESC;

'dlbjr
'Pleading sagacious indoctrination!

Alistair
10/31/2004 1:26:28 PM
hi peoples and masterful gurus (a little bit of grovelling never hurt
anyone...apart from the sore knees)

I'm after a little bit of advice on how to do something.

basically a history of the last 10 pages viewed or the id of the last 10
visitors to a page, but how do I make this "rolling"

e.g. a visitor looks at a page, his id is stored in an access 2000 db,
another vsitor then looks at the page, his id is also stored, when I get to
10 visitors I have 10 ID's stored, but when visitor 11 comes along, I would
like visitor 1 to be deleted and all the others nudged down by 1, and so on
when the 12th comes along.

more detailed explanation....

query last 10 visitors

after 10 visits

record 1 = visitor ID1
record 1 = visitor ID1
record 1 = visitor ID1


How would I go about doing this?

many thanks in advance

Alistair
10/31/2004 1:29:24 PM
sorry...hit the post button before I'd finished

SHOULD READ


hi peoples and masterful gurus (a little bit of grovelling never hurt
anyone...apart from the sore knees)

I'm after a little bit of advice on how to do something.

basically a history of the last 10 pages viewed or the id of the last 10
visitors to a page, but how do I make this "rolling"

e.g. a visitor looks at a page, his id is stored in an access 2000 db,
another vsitor then looks at the page, his id is also stored, when I get to
10 visitors I have 10 ID's stored, but when visitor 11 comes along, I would
like visitor 1 to be deleted and all the others nudged down by 1, and so on
when the 12th comes along.

more detailed explanation....

query last 10 visitors

after 10 visits

record 1 = visitor ID1
record 2 = visitor ID2
record 3 = visitor ID3
record 4 = visitor ID4
record 5 = visitor ID5
record 6 = visitor ID6
record 7 = visitor ID7
record 8 = visitor ID8
record 9 = visitor ID9
record10 = visitor ID10

after 15 visits

record 1 = visitor ID6
record 2 = visitor ID7
record 3 = visitor ID8
record 4 = visitor ID9
record 5 = visitor ID10
record 6 = visitor ID11
record 7 = visitor ID12
record 8 = visitor ID13
record 9 = visitor ID14
record10 = visitor ID15


How would I go about doing this?

many thanks in advance, and apologies again for the repost

Bob Lehmann
10/31/2004 1:33:18 PM
[quoted text, click to view]

So what? 15,000 rows is not a lot!!!

And, if your concern is disk space, and using Access, you will generate a
file that will be much bigger by "deleting" and reinserting.

Bob Lehman

[quoted text, click to view]

Alistair
10/31/2004 5:15:58 PM

[quoted text, click to view]

I see what you're doing, but....

if I have 1000 pages and each has 15 hits..I have 15,000 records!!!

this is what I'm trying to avoid. your method would work in the short term
and it's something that I briefly thought of, but need to reduce the record
count.

I guess I could always do

rs("record1") = rs("record2")
rs("record2") = rs("record3")
rs("record3") = rs("record4")
etc...
rs("record10") = new record
rs.update

but just wondered how anyone else would handle this

AddThis Social Bookmark Button