I'm need some help with some sql to return some data...obviously I have 3 tables. tbl_users, tbl_info, and tbl_images. I want to connect two tables tbl_info and tbl_images with tbl_users. The relationship with their is id_user Here is a simplified exmaple of table setup: tblusers id_user username ---------- 1 bob 2 peter tbl_info id_info id_user description ---------- 1 1 some desc 2 2 other desc tbl_images id_image id_user ---------- 1 1 img1 2 2 img2 I tried this code SELECT tbl_users.username, tbl_info.description, tbl_images.name FROM `tbl_users` JOIN users_info ON (tbl_users.id_user = tbl_info.id_user) JOIN tbl_images ON (tbl_users.id_user = tbl_images.id_image) PHP: But not work. how to solve the problem? Thanx!
Try this: SELECT tbl_users.username, tbl_info.description, tbl_images.name FROM `tbl_users` LEFT JOIN tbl_info ON tbl_users.id_user = tbl_info.id_user LEFT JOIN tbl_images ON tbl_users.id_user = tbl_images.id_user You need to double check your column names. They are inconsistant in your initial query.