Jump to content

PHP MYSQL JOIN command help needed


funstad

Recommended Posts

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

l3gykhO.png

 

IMAGE 2 (overview tables)

CA774Fr.png

Edited by funstad
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...