tqla Posted June 23, 2010 Share Posted June 23, 2010 Hello. I think this will be a JOIN but my to columns that the tables have in common have different names. The 'allusers' table has an 'id' column and a 'name' column. The 'doctors" table has an 'obj_id' column and a 'value' column. The 'id' table in the 'allusers' table matches the 'obj_id' column in the 'doctors' table. The 'value' column in the 'doctors' table will have a value of either 'patient' or 'provider'. How can I query the 'doctors' table and get the 'obj_id' of every record that has 'provider' in the 'value' column and then cross reference that with the 'id' column in the 'allusers' table so I can make an array containing the names of 'allusers' who are providers? Quote Link to comment https://forums.phpfreaks.com/topic/205684-help-with-a-join/ Share on other sites More sharing options...
miancu Posted June 23, 2010 Share Posted June 23, 2010 try something like: SELECT a.* FROM allusters a INNER JOIN doctors d ON a.id=d.obj_id WHERE d.value='provider' if I understood the requirement, this should work to give the allusters that are providers. hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/205684-help-with-a-join/#findComment-1076316 Share on other sites More sharing options...
tqla Posted June 24, 2010 Author Share Posted June 24, 2010 Thanks miancu! Inner Join! This will work I think. I just have to work with it a bit. Breaking out the INNER join docs now. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/205684-help-with-a-join/#findComment-1076322 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.