Jump to content

help with a JOIN


tqla

Recommended Posts

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?

Link to comment
Share on other sites

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!

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.