funstad Posted December 25, 2014 Share Posted December 25, 2014 (edited) hey all, I'm looking for the best way to make the following mysql update. I can do it with multiple mysql_query's but its not the best way if you are pulling 1000+ rows. I know it can be done with mysql JOIN but I'm totally new in this so I'm looking for an working example.So i can re-use it to solve my other problems by my self. Table Names: Adcount_input AS AI shop_product_attribute AS PA shop_product_attribute_combination AS PAC shop_stock_available AS SA 1 (see image 1) AI.ean13 = PA.ean13 (only allow example: TrekT80J15) 2 (see image 1) AI.id_soort = PAC.id_attribute (only allow example: 35) 3 (see image 1) AI.id_framemaat = PAC.id_attribute (only allow example: 11) 4. Count(*) rows left 5. UPDATE SA SET SA.quantity = count WHERE PA.id_product = SA.id_product AND PA.id_product_attribute = SA.id_product_attribute IMAGE 1 IMAGE 2 (overview tables) Edited December 25, 2014 by funstad Link to comment Share on other sites More sharing options...
niche Posted December 26, 2014 Share Posted December 26, 2014 Are you trying to update a table or take data from multiple files and insert data into another table? Link to comment Share on other sites More sharing options...
funstad Posted December 26, 2014 Author Share Posted December 26, 2014 (edited) shop_stock_available need to be updated with the correct quantity, id_product, and id_product_attribute are already filled in shop_stock_available. Edited December 26, 2014 by funstad Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now