That's close, but it ignores the ordering - if you want them both in the
same order, you can use a nested query. MSSQL syntax shown. Also, I've
added the use of the "percent" keyword, which doesn't place an assumption on
record count. I would do this in the database instead of CF - it'll execute
much faster.
SELECT TOP 50 PERCENT *
FROM employee
ORDER BY EmpoyeeID
SELECT *
FROM (SELECT TOP 50 PERCENT *
FROM employee
ORDER BY EmpoyeeID DESC) employee
ORDER BY EmployeeID
These two queries will return the top half and bottom half of the table,
respectively.
Roland
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Laurence Hoess
Sent: Thursday, October 13, 2005 7:06 PM
To: [email protected]
Subject: Re: [CFCDev] spliting recordset
Assuming you have 100 records.
SELECT TOP 50 *
from employee
Order by EmpoyeeID
SELECT TOP 50 *
from employee
Order by EmpoyeeID DESC
On 10/13/05, Ung, Seng <[EMAIL PROTECTED]> wrote:
>
>
> <cfQuery name="getData" datasource="#Application.dsn#" >
> SELECT * from employee
> </cfquery>
>
> ---> Query will returns 100 records
>
> What is the best way to split the first 50 assigned to dataset1 and the
last
> 50 assigned to dataset 2?
>
> ie:
> dataset1=getdata[1] to getdata[50]
>
> dataset1=getdata[51] to getdata[100]
>
> Thanks
> seng
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of
the
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.com).
>
> CFCDev is supported by New Atlanta, makers of BlueDragon
> http://www.newatlanta.com/products/bluedragon/index.cfm
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]