[AccessD] Sequence number in query

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Sat Jan 21 16:13:33 CST 2006


Gustav:

I'm trying to recall some trick that I've used before in the QBE grid to 
creating a column which numbers the records retrieved from 1. 

Rocky


Gustav Brock wrote:
> Hi Rocky
>
> If you don't have that many records this simple method may do if you have some unique key:
>
>   SELECT 
>     *,
>       (SELECT 
>         COUNT(*) 
>       FROM 
>         tblTable AS T 
>       WHERE 
>         T.[key] <= tblTable.[key];) AS 
>     SeqID
>   FROM 
>     tblTable
>   GROUP BY 
>     tblTable.[key]
>   ORDER BY 
>     tblTable.[key];
>
> /gustav
>
>   
>>>> bchacc at san.rr.com 21-01-2006 18:32:21 >>>
>>>>         
> Dear List:
>
> There is a trick to creating a column in a query with a sequence number 
> 1, 2, 3, 4... but I can't remember what it is.  Does anyone recall this?
>
> MTIA
>
>   

-- 
Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com




More information about the AccessD mailing list