Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
leosql
Starting Member
1 Post |
Posted - 2015-03-19 : 18:27:34
|
Hi Friends,I have four tables:a, b, c and dtable a is related to table b by a foreign key. table b is related to c and so on.I used the sql statement below to join the tables:$result = mysql_query("SELECT a.colum1, a.column2, b.column, c.column, d.column FROM aJOIN b ON a.pkey = b.foreign keyJOIN c ON b.pkey = c.fkeyJOIN d ON c.pkey = d.fkey ") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo $row['a.column1'].'<br>'; echo $row['a.column2'].'<br>'; echo $row['b.colum'].'<br>'; echo $row[‘c.coulm’].'<br>'; echo $row['d.column'].'<br>'; }mysql_close()?>I succeeded in printing out the first record where the four tables are joined, but not other instances.my print out is this:a.column1a.colum2b.columc.columd.columBut there are about ten instances where the joing conditions are met. how do i print out all the records that have met the condition?---- |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-03-19 : 19:24:04
|
You'll want to post your question on a site that specializes in mysql. SQLTeam is for Microsoft SQL Server.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2015-03-20 : 02:48:49
|
It is more about showing data in the php application. You may need to visit php related forumMadhivananFailing to plan is Planning to fail |
|
|
|
|
|