Solved

insert into while selecting from another table MySQL

Posted on 2014-12-03
3
560 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

756 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