Table1 has a
COLUMN called
"category" with the value "dog"
Table2 has also has
a COLUMN called "category" that contains a list of comma delimited values
of "dog, cat, mouse"
I'm trying to pull
all matching #category# values from Table2 that match the "category" value
contained in Table1. And then insert all these new values into a Table called
"Queue".
How can I modify the
queries below to accomplish this? I figure I might have to adjust the
<CFLOOP> to recognize each value in the comma delimited list.
Or do
something about the "LIKE operator".
Or maybe
both?
Still learning SQL,
so I'm not sure how to go about this.
<CFQUERY
NAME="checkCategory" DATASOURCE="db">
SELECT Table1.*, Table2.*
FROM Table1, Table2
SELECT Table1.*, Table2.*
FROM Table1, Table2
WHERE
Table1.category LIKE '%#category#%' AND Table2.category LIKE
'%#category#%'
</CFQUERY>
</CFQUERY>
<CFLOOP QUERY
="checkCategory">
<CFQUERY DATASOURCE="db">
INSERT INTO Queue (profileID, submissionID)
VALUES ('#profileID#', '#submissionID#')
</CFQUERY>
</CFLOOP>
<CFQUERY DATASOURCE="db">
INSERT INTO Queue (profileID, submissionID)
VALUES ('#profileID#', '#submissionID#')
</CFQUERY>
</CFLOOP>
Thank
You.
Arun
