Jump to content

Edit History

jarecki74

jarecki74

Please help

I have a SQL query

 

SELECT c.id_customer, c.firstname, c.lastname, count (o.id_order) AS ordercnt FROM pslh_customer c LEFT JOIN pslh_orders o ON c.id_customer = o.id_customer GROUP BY o.id_customer

 

gets data from 2 tables pslh_customer and pslh_orders and returns first name, last name, numberorders 

I need to add a phone number from the third table, pslh_address,  phone field

for result

as id_customer firstname lastname ordercnt phone

1 John DOE 5 666666666

2 Me because 1 666666666

 

I can't connect 3 tables :(

 

in the final step , I need to create a php file that connects to the database, executing this query and displaying the result

 

 

jarecki74

jarecki74

Please help

I have a SQL query

 

SELECT c.id_customer, c.firstname, c.lastname, count (o.id_order) AS ordercnt FROM pslh_customer c LEFT JOIN pslh_orders o ON c.id_customer = o.id_customer GROUP BY o.id_customer

 

gets data from 2 tables pslh_customer and pslh_orders and returns first name, last name, numberorders 

I need to add a phone number from the third table, pslh_address,  phone field

for result

as id_customer firstname lastname ordercnt phone

1 John DOE 5 666666666

2 Me because 1 666666666 I can't connect

 

in the final step , I need to create a php file that connects to the database, executing this query and displaying the result

 

 

×
×
  • Create New...