On Thu, 2005-09-29 at 19:51 -0300, Miles Thompson wrote: > At 04:13 PM 9/29/2005, redhat wrote: > >anyone know of any good tutorials on simple joining of tables in > >Postgres using PHP? I did some Googling and didn't find anything > >satisfactory. > >thanks, > >Doug > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > You mean like this, after establishing the connection ... > > $sql = "SELECT childname, childinitial, surname FROM children, parent WHERE > children.familykey = parent.familykey"; > > $result = pg_query( $sql); > > and then process the results using the appropriate pg_ commands. See the > manual. > > But the join is done with the SQL. > > Regards - Miles > I have been given a database with two tables in it that I need to extrapolate the data into some sort of readable format. On the first table (call it "logon") it really only has three columns: logon_id logon_name logon_passwd The second table (call it "client_data") has quite a few columns in it - most of which are not used - some of them are as follows: client_id last_name first_name home_phone addr logon_id In both tables the common denominator is the "logon_id" field. I need to tie the two together and display this information. If I run the following command: $sql = "SELECT logon_name, logon_passwd, last_name, first_name, home_phone, addr FROM logon, client_data WHERE logon.logon_id = client_data.logon_id"; $result = pg_query($sql); etc... Does this look right? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php