Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need assistance with a mysql query


Guest

Recommended Posts

Posted

I've played around with this for awhile and just not having any luck, so I thought there might be a mysql wizard out there that would be able to help me with this

 

I have taken on a client with an existing osc site with about 8,000 products in the db. There are many errors and ommissions, so I'm writing queries to the db to pull various info to compare with his products catalog from his distributor so that I can make the neccessary changes to the data.

 

One of my tasks is to get all the manufacturers related to the products. There are about 150 mfg's, and only about 100 of the 8000 products properly related So you can see this is a monumental undertaking.

 

I want to pull a query that will provide the following info, but I'm getting lost as I go here. :blush:

 

I need to pull - p.products_id, p.manufacturers.id, pd.products_id, pd.products_name, m.manufacturers_id, m.manufacturers_name

 

I am easily able to pull data from any "two" of the tables using an Inner Join, but when I throw the third table, manufactures in the mix, I start to have problems.

 

I need all of these fields displayed in a results table in order to be able to do the editing locally, then I'll convert the info to Insert statements and populate the manfacturers table in the db.

 

Any help here would be really great.

 

Ruth in AZ

Posted

SELECT P.products_id,PD.products_name,M.manufacturers_name

FROM (products P INNER JOIN products_description PD ON P.products_id=PD.products_id)

INNER JOIN manufacturers M ON P.manufacturers_id=M.manufacturers_id

WHERE PD.language_id=1

Posted
SELECT P.products_id,PD.products_name,M.manufacturers_name

FROM (products P INNER JOIN products_description PD ON P.products_id=PD.products_id)

INNER JOIN manufacturers M ON P.manufacturers_id=M.manufacturers_id

WHERE PD.language_id=1

 

 

Thanks so much. I'll try that right away and see if works for me. The second inner join is where I was having errors.

 

Ruth

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...