0 Replies - 281 Views - Last Post: 03 April 2014 - 01:13 PM Rate Topic: -----

#1 braddorl  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 15
  • Joined: 06-March 14

GROUP BY in CFC for Bound CFSELECT

Posted 03 April 2014 - 01:13 PM

I am trying to bind two CFSELECTS which works. In the updater.cfc I have the following query that works but I want to add GROUP BY ValtblJobs.Job so that my CFSELECT has only one instance of the many records fed to it. I have tried adding the group by several times but get an error executing the query.
<!--- Get TWDS by SHIP --->
	<cffunction name="getTWD" access="remote" returnType="array">
		<cfargument name="shipid" required="true">

		<!--- Define variables --->
		<cfset var data="">
		<cfset var result=ArrayNew(2)>
		<cfset var i=0>

		<!--- Get data --->
		<cfquery name="data" datasource="dashboard">
		SELECT DatatblQDLog.QDLogShip, ValtblJobs.JobID, ValtblJobs.Job
		FROM ValtblJobs INNER JOIN DatatblQDLog ON ValtblJobs.JobID = DatatblQDLog.QDLogJob
		WHERE QDLogShip = '#ARGUMENTS.shipID#'
		ORDER BY Job
		</cfquery>
			
		<!--- Convert results to array --->
		<cfloop index="i" from="1" to="#data.RecordCount#">
			<cfset result[i][1]=data.JobID[i]>
			<cfset result[i][2]=data.Job[i]>
		</cfloop>

		<!--- And return it --->
		<cfreturn result>



Is This A Good Question/Topic? 0
  • +

Page 1 of 1