> Hey guys. I have a query that selects about 2,000 rows (by project id) from a table.
Let's call that ID firstID.
> Then I use those values to compare with the same table using another query (but from a different project ID.
Let's call that ID secondID.
> Any numbers that aren't the same are appended to a variable named error_list. I'm basically using a CLOOP query using the first query to loop over the second query. So it's basically like #firstquery.recordcount# loops and checking each value.
>
> pseudo code
>
> <CFLOOP query="firstquery">
>
>
> <CFQUERY name="secondquery">
> SELECT name
> from images
> where project_id = #url.id# AND name = #name#
> </CFQUERY>
>
> <CFIF secondquey.recordcount EQ 0>
> <CFSET error_list = listappened(error_list, name)>
> </CFIF>
>
> </CFLOOP>
>
> <CFOUTPUT>#error_list#</CFOUTPUT>
Your explanation and code are slightly inconsistent, but I
presume you mean this:
<cfquery name="theQuery">
SELECT i.name
FROM images i LEFT JOIN images j
ON i.name = j.name
WHERE i.project_id = <cfqueryparam cfsqltype="cf_sql_integer"
value="#URL.firstID#">
AND j.project_id = <cfqueryparam cfsqltype="cf_sql_integer"
value="#URL.secondID#">
AND j.name IS NULL
</cfquery>
<cfoutput>#ValueList(theQuery.name)#</cfoutput>
Jochem
--
Who needs virtual reality
if you can just dream?
- Loesje
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]