0
Insert Query
LEGEND
,
/t5/coldfusion-discussions/insert-query/td-p/225492
Jul 23, 2008
Jul 23, 2008
Copy link to clipboard
Copied
Hello - What is the best method to take the results of a
query that
returns a series of records based on an order number (ex. Order Number
is 1234ABC and returns 5 records that include sku, qty and price) and
insert the query results into a db table?
Any help is appreciated.
Thanks,
Steve
returns a series of records based on an order number (ex. Order Number
is 1234ABC and returns 5 records that include sku, qty and price) and
insert the query results into a db table?
Any help is appreciated.
Thanks,
Steve
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/insert-query/m-p/225493#M20072
Jul 23, 2008
Jul 23, 2008
Copy link to clipboard
Copied
If the data is already coming from a db query, the best
method might be to do nothing.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/coldfusion-discussions/insert-query/m-p/225494#M20073
Jul 23, 2008
Jul 23, 2008
Copy link to clipboard
Copied
Steve Miller wrote:
> Hello - What is the best method to take the results of a query that
> returns a series of records based on an order number (ex. Order Number
> is 1234ABC and returns 5 records that include sku, qty and price) and
> insert the query results into a db table?
>
> Any help is appreciated.
>
> Thanks,
> Steve
This is a bit of a strange question as worded. You are querying a
database getting data from one or more tables. And you now want to
store this data into a database table?
Anyway, the basic idea of putting repeating data into a table is simple.
Loop over data. Build <cfquery...> insert SQL block for each iteration.
Rinse. Repeat.
> Hello - What is the best method to take the results of a query that
> returns a series of records based on an order number (ex. Order Number
> is 1234ABC and returns 5 records that include sku, qty and price) and
> insert the query results into a db table?
>
> Any help is appreciated.
>
> Thanks,
> Steve
This is a bit of a strange question as worded. You are querying a
database getting data from one or more tables. And you now want to
store this data into a database table?
Anyway, the basic idea of putting repeating data into a table is simple.
Loop over data. Build <cfquery...> insert SQL block for each iteration.
Rinse. Repeat.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Newsgroup_User
AUTHOR
LEGEND
,
/t5/coldfusion-discussions/insert-query/m-p/225495#M20074
Jul 23, 2008
Jul 23, 2008
Copy link to clipboard
Copied
This is actually a case where a customer has placed a
previous order
(which is where the order number comes from) and would like to duplicate
the order. The previous order is displayed on the page with the option
to duplicate (submit reorder). Make more sense?
Dan Bracuk wrote:
> If the data is already coming from a db query, the best method might be to do nothing.
(which is where the order number comes from) and would like to duplicate
the order. The previous order is displayed on the page with the option
to duplicate (submit reorder). Make more sense?
Dan Bracuk wrote:
> If the data is already coming from a db query, the best method might be to do nothing.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/insert-query/m-p/225496#M20075
Jul 23, 2008
Jul 23, 2008
Copy link to clipboard
Copied
quote:
Originally posted by: Newsgroup User
This is actually a case where a customer has placed a previous order
(which is where the order number comes from) and would like to duplicate
the order. The previous order is displayed on the page with the option
to duplicate (submit reorder). Make more sense?
Dan Bracuk wrote:
> If the data is already coming from a db query, the best method might be to do nothing.
That would make it a new order then, would it not?
The sql would be something like
insert into mytable
(order_number, field2, etc)
select 'new_order_number', field2, etc
from mytable
where order_number = 'old_order_number'
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

