Ask a Question related to Coldfusion Database Access, Design and Development.
-
xSeanx #1
Complicated Insert
I have several rows of data in a table which i want to insert into only 1 row
in another table.
Is it possible to do an insert query from a select query?
Alternatively how can i create a list variable from a query?
eg query:
SELECT Name FROM Names WHERE Country = '#Form.Country#'
So the list will look like: name1, name2, etc...
xSeanx Guest
-
Complicated text flow
Please see the this example at <http://iwillglo.com/practice/overset.html> I have a journal that is set up as shown in the example with article... -
Complicated variable
I have a database query, which i output and also use 2 loops in. optionx and qtyx are loop index's. i want to use those loop index's to output a... -
pattern need help... so complicated
hi, need some help over how to create this pattern... <http://img47.photobucket.com/albums/v144/kylekwan/pattern.jpg> I'm using AI 10. Have... -
A bit more complicated....
can any one help me with this ? if i press the button refresh in my browser my movie stop playing i tried to insert a rewind in my script but it... -
Requesting help with complicated query
Hi, Sorry, for the lack of info in the title. Just don't know how to simplify it. I have previously been asked to post my questions in a certain... -
The ScareCrow #2
Re: Complicated Insert
To do this totally in a single query would depend on what db your using.
But, you could do
<cfquery name="Q1">
SELECT Name FROM Names WHERE Country = '#Form.Country#'
</cfquery>
<cfquery name="Q2">
Insert Into myTable(
<cfloop from="1" to="#Q1.RecordCount#" index="idx">Name#idx#</cfloop>
Values(
<cfloop from="1" to="#Q1.RecordCount#" index="idx">
'#Q1.Name[idx]#'
<cfif idx NEQ Q1.RecordCount>
,
</cfif>
</cfloop>
Ken
The ScareCrow Guest
-
OldCFer #3
Re: Complicated Insert
I hope you're not planning on storing lists like that in the database. It is not good, usually.
OldCFer Guest
-
Scott*e #4
Re: Complicated Insert
Hi,
You can write queries like:
insert into tablename
(
..
)
select
....
from
someothertablename
just make sure the same number of colums and data types match.
You can use
QuotedValueList(queryname.fieldname) to create a quoted comma delimited list
Scott*e Guest



Reply With Quote

