ellegua220 Posted March 11, 2011 Share Posted March 11, 2011 can someone break this statement down? what are the u and pu and p? is that shorthand for user, parent_user and parent? if so, what if you had 2 tables with the same first letter? also can you break down the join for me with an example data set? > $query="SELECT * FROM user u LEFT JOIN parent_user pu ON pu.userid = > u.userid LEFT JOIN parent p ON p.parent_id = pu.parent_id WHERE > u.userid = $userid"; > Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted March 11, 2011 Share Posted March 11, 2011 Yes, those are table aliases and they are set in the query to be shorter, they can be anything you want not just the first letter. You could do this: SELECT * FROM user t1 LEFT JOIN parent_user t2 ON t2.userid = t1.userid LEFT JOIN parent t3 ON t3.parent_id = t2.parent_id WHERE t1.userid = $userid Quote Link to comment Share on other sites More sharing options...
ellegua220 Posted March 11, 2011 Author Share Posted March 11, 2011 thanks! Quote Link to comment 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.