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 Quote Link to comment 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 Quote Link to comment 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"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.