radar Posted May 13, 2008 Share Posted May 13, 2008 One thing I am totally not good with is join statements. I've used them maybe once or twice in my whole career of programming in PHP... So through this post I am looking for someone to 'setup' my join query for me based on the information below... so I have 2 tables i need to get all the information from... table 1: users u_id (key) d_id (department id) f_name l_name d_name (display name) email password date_added status (still active or no) table 2: departments d_id d_name d_id is in both tables, it is also always going to be a number. same with u_id... All I need is how to setup the query, I can do the parsing and get it setup as an array suitable to send it into Smarty. Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/105484-solved-proper-join-statement/ Share on other sites More sharing options...
pocobueno1388 Posted May 13, 2008 Share Posted May 13, 2008 See if this gives you what you want. SELECT u.u_id , u.d_id, u.f_name, u.l_name, u.d_name, u.email, u.password, u.date_added, u.status, d.d_name FROM users u LEFT JOIN departments d ON d.d_id = u.u_id Link to comment https://forums.phpfreaks.com/topic/105484-solved-proper-join-statement/#findComment-540298 Share on other sites More sharing options...
radar Posted May 13, 2008 Author Share Posted May 13, 2008 Works like a charm. Thank you very much... Link to comment https://forums.phpfreaks.com/topic/105484-solved-proper-join-statement/#findComment-540302 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.