SELECT TOP Flaking Out...
From: Quasi (Quasi_at_discussions.microsoft.com)
Date: 09/26/04
- Next message: Adil Akram: "ASP Session, Cookies and SSL"
- Previous message: Scott: "Re: Page Timeout"
- Next in thread: Bob Barrows [MVP]: "Re: SELECT TOP Flaking Out..."
- Reply: Bob Barrows [MVP]: "Re: SELECT TOP Flaking Out..."
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 25 Sep 2004 18:53:01 -0700
I'm having a very frustrating problem...I've got two pages, each of which are
supposed to do basically the same thing, but from two different tables. Both
use SELECT TOP n in the SQL statement to get only a certain number of
records. One of them works (only returns 3 rows) and the other does not
(returns all rows)...I don't get it.
This one works:
"SELECT TOP 3 lngID, strName, datDateStart, datDateEnd " &_
"FROM Events " &_
"WHERE bitHide=False AND datDateShowAsOf <= #" & Date & "# " &_
"ORDER BY datDateStart;"
This one doesn't:
"SELECT TOP 3 lngID, strName " &_
"FROM News " &_
"WHERE bitHide=False AND datDateShowAsOf <= #" & Date & "# " &_
"ORDER BY datDatePosted DESC;"
I tried the second one without specifying the DESC part, thinking that might
be it, but still didn't work. I can change the value of the TOP part of the
first statement up there and it always returns the correct number of rows...I
have no idea why the second one doesn't and always returns all rows.
Any advice would be greatly appreciated...thanks in advance!
LZ
- Next message: Adil Akram: "ASP Session, Cookies and SSL"
- Previous message: Scott: "Re: Page Timeout"
- Next in thread: Bob Barrows [MVP]: "Re: SELECT TOP Flaking Out..."
- Reply: Bob Barrows [MVP]: "Re: SELECT TOP Flaking Out..."
- Messages sorted by: [ date ] [ thread ]