"James Tu" <[EMAIL PROTECTED]> wrote in message = news:[EMAIL PROTECTED]
> I want to do a query of all employees from Maine, ordered by hiring =20 > date, and figure out where Joe falls in that list. (i.e. which record = > number is he?) I think this can only be accomplished with a temporary table. SET @n:=3D0; SELECT t.name, t.n FROM (SELECT @n:[EMAIL PROTECTED] AS n, name FROM t WHERE state = =3D 'Maine' ORDER BY hire DESC) t WHERE t.name =3D 'Foo'; This query though may not be suitable for most situations as its = performance depends heavly on the size of the derived table.=20 Maciek -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]