Thank you Adam & Dan,
   I am using sql 2000 and I couldn't get your example
to run but modifying it using the "IN" keyword it does! is this ok ? (it works)

<cfquery name="a" datasource=******>
 select top 10 id, (select count(id) from myTable) as totalRecords
 from myTable
 where id IN (select top 20 id
              from myTable
              order by id asc)
 order by id desc
</cfquery>

Andrew.

>Andrew,
>
>To add to what Adam said, you can even do:
>
>select 
>       *, (select count(*) from table) as totalRecords
>from
>       table
>
>To grab the total number of records as a column. 
>
>NOTE: You want to try to avoid using "*" in your select statements--I'm
>using it for brevity.
>
>-Dan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236517
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to