knowram Posted October 6, 2007 Share Posted October 6, 2007 I have 3 tables a, b, and c. I know what is in table a and I want the related info from table b and a. Is there some what to do that in one query? Some thing like $result = mssql_query("select c.info from c and b.get from b JOIN b ON c.index = b.index JOIN a ON b.index2 = a.index WHERE a.get = '12115'") or die ("Can't get info"); while ($aDevice = mssql_fetch_array($result, MSSQL_ASSOC)){ echo'<pre>'; print_r($aDevice); echo'</pre>'; } that probably doesn't make any sense but I hope someone gets the idea. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/72109-solved-using-join/ Share on other sites More sharing options...
BlueSkyIS Posted October 6, 2007 Share Posted October 6, 2007 yes, your idea will work. what are the results using what you have? unfortunately, i don't know MSSQL SQL Link to comment https://forums.phpfreaks.com/topic/72109-solved-using-join/#findComment-363478 Share on other sites More sharing options...
Barand Posted October 6, 2007 Share Posted October 6, 2007 Your SQL syntax is wrong. Try $result = mssql_query("select c.info , b.get from c JOIN b ON c.index = b.index JOIN a ON b.index2 = a.index WHERE a.get = '12115'") or die ("Can't get info"); Link to comment https://forums.phpfreaks.com/topic/72109-solved-using-join/#findComment-363573 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.