I think this is what you are trying to do:

<!--- page you are on: defaults to 1 --->
<cfparam name="url.thisPage" default="1">
<!--- records to show per page --->
<cfset recordsPerPage = 10>
<!--- records on previous pages --->
<cfset previousRecords = (url.thisPage - 1)*recordsPerPage>
<cfparam name="URL.SortBy" default="PropertyAgentID ASC">
<CFQUERY NAME="GetAgentList" datasource="020">
SELECT TOP #variables.recordsPerPage# *
FROM PropertyAgent
WHERE PropertyAgentID NOT IN (
  SELECT Top #variables.previousRecords#
  FROM PropertyAgent
  ORDER BY #URL.SortBy#
)
ORDER BY #URL.SortBy#
</CFQUERY>

Pascal

> -----Original Message-----
> From: Stuart Kidd [mailto:[EMAIL PROTECTED]
> Sent: dinsdag 3 februari 2004 20:12
> To: CF-Talk
> Subject: RE: Get Records
>
> Hi Pascal,
>  
> I've been trying to give that one a go but without much luck.  My code
> is:
>  
>     <cfparam name="url.StartResults" default="1">
>             <cfparam name="URL.SortBy" default="PropertyAgentID ASC">
>                        
>                           <CFQUERY NAME="GetAgentList"
> datasource="020">
>                                     SELECT TOP #URL.StartResults#
>                                     *
>                                     FROM
>                                     PropertyAgent
>                                     AND #URL.StartResults# NOT IN (
>                                     SELECT Top #URL.StartResults# FROM
>                                     PropertyAgent
>                                     ORDER BY #URL.SortBy#
>                                     )
>                                     ORDER BY #URL.SortBy#
>
>                           </CFQUERY>
>  
> I'm really not sure what I'm doing, kind of very confused.  
> Can you see what is wrong?
>  
> Thanks,
>  
> Stuart
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to