• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Insert Query

LEGEND ,
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
TOPICS
Advanced techniques

Views

406

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 23, 2008 Jul 23, 2008

Copy link to clipboard

Copied

LATEST
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'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation