Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

sql query


snk7

Recommended Posts

Posted

Hello,

 

i would like to make a query to get 3 fields from 3 different tables

 

products.products_model, products_description.products_name, categories_description.categories_name

 

I can have the first 2 by JOIN but party begins when categories_name comes into the game...

 

I have 4 languages into the e-shop, i need just one.

 

can somebody give me a tip? Im very confused with subqueries and JOINS in JOINS :(

 

thanks in advance for any consideration

Posted

Heya,

 

try this

 

SELECT a.products_model, b.products_name, c.categories_name

FROM products a, products_description b, categories_description c, products_to_categories d

WHERE a.products_id = b.products_id

AND a.products_id = d.products_id

AND d.categories_id = c.categories_id

AND b.language_id = your_language_id_number

 

 

I'm doing this out of my head as I do not have phpmyadmin at hand here so I can't test the query for you.

But this should be pretty close to what you're looking for.

 

If you are not able to figure it out from here, i'll be back online in about 2 hours, then I can test the query and get it right for you.

Posted

Heya,

 

try this

 

SELECT a.products_model, b.products_name, c.categories_name

FROM products a, products_description b, categories_description c, products_to_categories d

WHERE a.products_id = b.products_id

AND a.products_id = d.products_id

AND d.categories_id = c.categories_id

AND b.language_id = your_language_id_number

 

 

I'm doing this out of my head as I do not have phpmyadmin at hand here so I can't test the query for you.

But this should be pretty close to what you're looking for.

 

If you are not able to figure it out from here, i'll be back online in about 2 hours, then I can test the query and get it right for you.

 

You have a very nice head... it works :)

Archived

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

×
×
  • Create New...