RE: TOP function not performing

2001-04-11 Thread David Shadovitz
Let me add some notes on the TOP predicate as implemented in MS Access. 1. If you don't include an ORDER BY clause, a TOP N query will return an arbitrary set of N records that satisfy the WHERE clause. 2. You may get more than N rows from a TOP N query, since TOP does not choose between

RE: TOP function not performing

2001-04-10 Thread Simon Horwith
try the same query with ORDER BY clauses in both the query and it's sub-query, if there is a sub-query. ~Simon Simon Horwith Macromedia Certified Instructor Certified ColdFusion Developer Fig Leaf Software 1400 16th St NW, # 500 Washington DC 20036 202.797.6570 (direct line) www.figleaf.com

Re: TOP function not performing

2001-04-10 Thread W Luke
try the same query with ORDER BY clauses in both the query and it's sub-query, if there is a sub-query. ORDER BY - should I be ordering by ID in this case? SELECT TOP 2 ID,Left(subject,20) AS subjects,end_date FROM advert_details ORDER BY end_date DESC Will -- [EMAIL PROTECTED] -=-

Re: TOP function not performing

2001-04-10 Thread W Luke
SELECT TOP 2 ID,Left(subject,20) AS subjects,end_date FROM advert_details ORDER BY end_date DESC - Original Message - From: ""Hayes, David"" [EMAIL PROTECTED] Newsgroups: dotcom.lists.cftalk Sent: Tuesday, April 10, 2001 9:25 PM Subject: RE: TOP function not perfor

RE: TOP function not performing

2001-04-10 Thread Hayes, David
field? Or is it perhaps text? -Original Message- From: W Luke [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 10, 2001 4:00 PM To: CF-Talk Subject: Re: TOP function not performing try the same query with ORDER BY clauses in both the query and it's sub-query, if there is a sub-query

Re: TOP function not performing

2001-04-10 Thread W Luke
Your ORDER BY field(s) should determine which records are returned; it your example, you should be getting the 2 records with the highest end_date value. If you order by ID, you'll get 2 records with the lowest (sorted ascending) or highest (sorted descending) ID. So my code is correct