TOP 10 is a MsSql server command NOT an ANSI SQL-92 Sql syntax..

Jim you should buy SQL for Smarties by Joe Clecko, it has ANSI ways of doing
this and many other tricks(trees )

EG. Get the top 3 earners

SELECT DISTINCT COUNT(*), A.salary
FROM Employees AS A, Employees AS B
WHERE (A.salary <= B.Salary)
GROUP BY A.salary
HAVING COUNT(*) <= 3 // change this for top n

JustinMacCarthy



----- Original Message -----
From: "Patricia Lee" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, October 20, 2000 1:18 PM
Subject: RE: top 10 is not a field


> Top 10 IS a SQL Command.  I copied this statemtent directly from my SQL 7
> Enterprise manager if you still don't believe:
>
> SELECT TOP 10 *
> FROM [dbo].[objects]
>
> It returns the top 10 rows, all columns.
>
> -----Original Message-----
> From: Jim Watkins [mailto:[EMAIL PROTECTED]]
> Subject: top 10 is not a field
>
>
> I noticed when I posted my question on "selecting the top ten of a list of
> counties" that 2 or 3 responded with something like: "Select top 10 * (or
> your fields)" now how would CF and Oracle respond to such a statement as
> 'top ten' as it is not a SQL command (as far as I know) or even a field in
> my query?
>
>
> --------------------------------------------------------------------------
----------------------
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send
a message with 'unsubscribe' in the body to
[EMAIL PROTECTED]
>
>

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to