Solved

insert into while selecting from another table MySQL

Posted on 2014-12-03
3
570 Views
Last Modified: 2014-12-03
I want to insert into Inventory_Parts and select some of the values from  Inventory_InventoryList table and I want to do it for every item in the Inventory_InventoryList table...... how do I do it?



INSERT INTO `Inventory_Parts`(`UID`, `LocationID`, `Quantity`, `Desc`, `Notes`, `ConditionID`, `InventoryListID`) VALUES (0,0,25,desc,'',1,listid)

select UID as 'listid',Desc as 'desc' FROM Inventory_InventoryList

Open in new window

0
Comment
Question by:r3nder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
Ahmed Merghani earned 500 total points
ID: 40479279
Try this:
INSERT INTO `Inventory_Parts`(`UID`, `LocationID`, `Quantity`, `Desc`, `Notes`, `ConditionID`, `InventoryListID`) 
select 0,0,25, Desc ,'', 1, UID  FROM Inventory_InventoryList

Open in new window

0
 
LVL 6

Author Closing Comment

by:r3nder
ID: 40479405
Thank you Ahmed! worked perfect
0
 
LVL 8

Expert Comment

by:Ahmed Merghani
ID: 40480128
You are welcome.
0

Featured Post

RHCE - Red Hat OpenStack Prep Course

This course will provide in-depth training so that students who currently hold the EX200 & EX210 certifications can sit for the EX310 exam. Students will learn how to deploy & manage a full Red Hat environment with Ceph block storage, & integrate Ceph into other OpenStack service

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question