luminous Posted July 11, 2010 Share Posted July 11, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/207451-join-query-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.