Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
insert, column name from select
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Julien Mills  
View profile   Translate to Translated (View Original)
 More options 6 Nov, 14:12
Newsgroups: comp.databases.mysql
From: Julien Mills <jul...@amorosobaking.com>
Date: Fri, 06 Nov 2009 08:12:27 -0600
Local: Fri 6 Nov 2009 14:12
Subject: insert, column name from select
Hi all,

This is what I want to do, not sure if
it is possible:

I'd like to run an insert where the column
names inserted into are based on the results
of the query, like this:

create table DETEMP
        (product,
        name,
        quantity,
        DE1,
        DE2,
        DE3);

insert into DETEMP
        (product, name, quantity, columnname)
select product,
        name,
        quantity,
        columnname
from SALESDETAIL;

Essentially I want to insert into either DE1, DE2, DE3
depending on the value of the columname column in SALESDETAIL.
Does anyone know of a good way to handle this?
I hope I'm explaining this clearly.

Thanks,

Julien


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Captain Paralytic  
View profile   Translate to Translated (View Original)
 More options 6 Nov, 14:18
Newsgroups: comp.databases.mysql
From: Captain Paralytic <paul_laut...@yahoo.com>
Date: Fri, 6 Nov 2009 06:18:15 -0800 (PST)
Local: Fri 6 Nov 2009 14:18
Subject: Re: insert, column name from select
On 6 Nov, 14:12, Julien Mills <jul...@amorosobaking.com> wrote:

What do you want to insert into DE1, DE2 or DE3?
You are putting;
product->product
name->name
quantity->quantity
but you haven't explained what it is you want to put into the column
referenced by columname???

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter H. Coffin  
View profile   Translate to Translated (View Original)
 More options 6 Nov, 15:04
Newsgroups: comp.databases.mysql
From: "Peter H. Coffin" <hell...@ninehells.com>
Date: Fri, 6 Nov 2009 09:04:08 -0600
Local: Fri 6 Nov 2009 15:04
Subject: Re: insert, column name from select

Probably ought to put DE1, DE2, and DE3 out in their own table, linking
back to DETEMP via foreign key constraint, especially if your products
may have a variable number of DEn values.

--
79. If my doomsday device happens to come with a reverse switch, as soon as it
    has been employed it will be melted down and made into limited-edition
    commemorative coins.
                --Peter Anspach's list of things to do as an Evil Overlord


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google