Jump to content

JOIN Query Help


luminous

Recommended Posts

I have the following tables:

ordersl:

id_order 	id_carrier 	id_lang 	id_customer 	id_cart 	id_currency 	id_address_delivery 	id_address_invoice

customization:

id_customization 	id_product_attribute 	id_cart 	id_product 	quantity 	quantity_refunded 	quantity_returned

 

customization data:

 id_customization 	type 	index 	value

 

I'm trying to get each value field from the customization data table where the id_cart field in the orders table is equal to the id_cart field in the customization field

 

The relationships are as follows

 

Orders [One to One] Customization

Customization [One to Many] Customization data

 

I'm really don't understand joins to well but here is the query I've been using and it returns the data i want (for this example it should return two fields of 'values') but is instead returning the values 12 times! I've tried all kinds of combinations of joins to try and get what I want but it doesn't seem to make a difference

 

Here's the query I'm using:

SELECT
  ps_customized_data.value
FROM
  pres.ps_customization_field, pres.ps_customization_field_lang, pres.ps_orders INNER JOIN pres.ps_customization RIGHT OUTER JOIN pres.ps_customized_data ON ps_customization.id_customization = ps_customized_data.id_customization
WHERE
  ps_orders.id_cart = ps_customization.id_cart AND ps_customization.id_customization = ps_customized_data.id_customization

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.