Re: Plz, help

From: Date: Tue, 12 Jul 2005 10:06:58 +0000
Subject: Re: Plz, help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-218524@lists.php.net to get a copy of this message
""adolfas"" <adolfas@nese.lt> wrote in message news:27.17.23681.6F663D24@pb1.pair.com... > 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

« previous php.general (#218524) next »