Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

joining 3 tables


4 replies to this topic

#1 daone

  • Community Member
  • 20 posts
  • Real Name:Manni
  • Gender:Male
  • Location:UK

Posted 31 July 2009, 12:19

I am trying to join a table measurement to customer in the admin folder but keep getting this error:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') c left join measurement m on c.customers_measurements_id = m.measurement_id wh' at line 1
.

can anyone help.

#2 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 31 July 2009, 13:05

And your sql statement is?

Jack

#3 daone

  • Community Member
  • 20 posts
  • Real Name:Manni
  • Gender:Male
  • Location:UK

Posted 31 July 2009, 13:24

View PostJack_mcs, on Jul 31 2009, 02:05 PM, said:

And your sql statement is?

Jack

$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, m.neck_measurement, m.chest_measurement, m.sleeve_measurement, m.stomach_measurement, m.waist_measurement, m.outer_leg_measurement, m.inside_leg_measurement, m.length_measurement, m.shoulder_measurement, m.bust_measurement, m.hip_measurement, m.crotch_measurement, m.back_measurement, m.cuff_measurement, m.thigh_measurement, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id, c.customers_measurements_id from (" . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id) where a.customers_id = c.customers_id and c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "') left join ". TABLE_MEASUREMENT ." m on c.customers_measurments_id = measurement_id");

#4 Jack_mcs

  • Community Member
  • 24,449 posts
  • Real Name:Jack
  • Gender:Male

Posted 31 July 2009, 14:33

Try this
	$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, m.neck_measurement, m.chest_measurement, m.sleeve_measurement, m.stomach_measurement, m.waist_measurement, m.outer_leg_measurement, m.inside_leg_measurement, m.length_measurement, m.shoulder_measurement, m.bust_measurement, m.hip_measurement, m.crotch_measurement, m.back_measurement, m.cuff_measurement, m.thigh_measurement, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id, c.customers_measurements_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on a.customers_id = c.customers_id left join " . TABLE_MEASUREMENT . " m on c.customers_measurments_id = m.measurement_id where  c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");

Jack

#5 daone

  • Community Member
  • 20 posts
  • Real Name:Manni
  • Gender:Male
  • Location:UK

Posted 01 August 2009, 15:00

View PostJack_mcs, on Jul 31 2009, 03:33 PM, said:

Try this
	$customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, m.neck_measurement, m.chest_measurement, m.sleeve_measurement, m.stomach_measurement, m.waist_measurement, m.outer_leg_measurement, m.inside_leg_measurement, m.length_measurement, m.shoulder_measurement, m.bust_measurement, m.hip_measurement, m.crotch_measurement, m.back_measurement, m.cuff_measurement, m.thigh_measurement, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id, c.customers_measurements_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on a.customers_id = c.customers_id left join " . TABLE_MEASUREMENT . " m on c.customers_measurments_id = m.measurement_id where  c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");

Jack

Thank u, Thank u, Thank u, it worked a treat.