I am really trying to understand what you are doing here. The student2 query doesn't even appear to be used. You are setting list1 as stuid but it is unscoped so I am not sure where that is coming from. If you could explain what you are trying to accomplish I can better help you.
Thank you for your reply. I want to do a query that will collect and list the primary id's of all of my students who are currently inactive. The intent of the is to contain the studentID's for later insertion into another table entitled "student_attendance". The goal is To insert Each ID's consecutively until the #list1# is exhausted. This query will run every 30 days or so. So it may be 10, 15, 20 at a time that is being inserted with just one query. When the insert is executed the results looks like the following:
I want it to execute like this:
Am I doing something wrong?
Why are you trying to read the data into ColdFusion and then send it back again? You can do it in one SQL statement:
<cfquery name="insertabsentee" datasource="master">
INSERT INTO student_attendance (stuid, name)
select stuid, fname
where type = 'senior'
AND squadlt = '#session.user_id#'
AND CITY = 'richmond'
AND STATUS = 'i'