Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Other > Selecting a particular record

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-18-02, 11:06
glenstobbs glenstobbs is offline
Registered User
 
Join Date: Mar 2002
Location: Somerset, UK
Posts: 1
Question Selecting a particular record

Using ASP I am calling records from a table where a username = cookie username. That's the easy part, and it works fine. Even sorting by date works fine. BUT, I want to select the second last record (by date) - I tried a SELECT TOP ...... but it still gives me the data from the latest record.

What I am trying to achieve is a lookup to see when last somone visited a webpage. The page they open writes to the stats table on entry, so the data showing their last visit is ... well, Today (cos it just called the record it wrote a millisecond ago!

Any help would be greatly appreciated. I am now almost bald thanks to my dabbling in ASP etc!

Glen R Stobbs
glen@glenstobbs.com
http://www.glenstobbs.com
__________________
Glen R Stobbs
glenglenstobbs.com
Reply With Quote
  #2 (permalink)  
Old 03-19-02, 21:03
BrendtHess BrendtHess is offline
Registered User
 
Join Date: Jan 2002
Posts: 10
Try something like this:

SELECT TOP 1 * FROM MyTable WHERE MyDate < (Select Top 1 MyDate FROM MyTable WHERE UserID = 'whatever') AND UserID = 'Whatever'
__________________
Brendt

We are the music makers, and We are the dreamers of dreams...
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On