Can we use Query of Queries to insert into a DB table?
Hi,
Can we use Query of Queries to insert into database. For example:
Here email value is obtained from an array.
<cfquery name="chkexistingrecord" datasource="#DSN#">
select * from records where email = #arrDat[3]#
</cfquery>
<cfif chkexistingrecord.recordcount gte 1>
<cfquery name="insertduplicate" dbtype="query">
INSERT INTO [Duplicate_Records]
(
[record created]
,[record updated]
,[email]
values
#chkexistingrecord['record created'][1]#
,#chkexistingrecord['record updated'][1]#
,#chkexistingrecord['email'][1]#
)
</cfquery>
Both records and the Duplicate records tables are in the same database. When I
tried doing this I got the following error.
Message: Error Executing Database Query.
Detail: Query Of Queries syntax error.
Encountered "INSERT.
