If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Complicated Insert Statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-04, 09:18
jkruer01 jkruer01 is offline
Registered User
 
Join Date: Oct 2004
Posts: 2
Complicated Insert Statement

Hello,

I have a question. I have two tables tableOne has a fields bug_id and resolution. TableTwo has fields bug_id, version_type, and version.

I need to create an insert statement that inserts the tableOne.bug_id into tabletwo.bug_id where tableOne.resolution='DOCUMENTED'.

Can someone please show me how to do this?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-08-04, 09:48
RBARAER RBARAER is offline
Registered User
 
Join Date: Aug 2004
Location: France
Posts: 754
Hello,

Well, it is almost as you have written it :
Code:
Insert into tabletwo(bug_id) 
select bug_id 
from tableone 
where resolution='DOCUMENTED';
Regards,

RBARAER
Reply With Quote
  #3 (permalink)  
Old 10-08-04, 10:10
jkruer01 jkruer01 is offline
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks, that did exaclty what I wanted. I have never used an insert statement like that before.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On