""adolfas"" <adolfas@xxxxxxx> wrote in message news:27.17.23681.6F663D24@xxxxxxxxxxxxxxx > Hi, > > I have a line: > > $sql="select u.*, p.name_lt as pareiga from nese_users u left join > nese_pareigos p on p.id=u.pareiga order by data desc"; > > As I understand there are 2 tables: nese_users and nese_pareigos > I need to know what atributes belong to what table form that line. > Thanks I hope this is what you mean. Try this for further reading if so http://www.w3schools.com/sql/default.asp Breaking it down: select --retrieve the following fields u.*, --* means all fields from this table (u) p.name_lt as pareiga -- and name_lt (renamed to pareiga) from table (p) from nese_users u --(this is table u, as in u.*) left join --retrieve all of the rows from table u, as well as all the rows in the next table where the ON condition is true nese_pareigos p --this is table p, as in p.name_lt on p.id=u.pareiga --this restricts the rows retrieved from table p order by data desc --means that the rows returned are ordered in this way -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php