Jump to content

Distinct with a join? is it possible???


jbradley04

Recommended Posts

Hello,

I am trying to populate a dropdown menu from multiple tables in a db...  here is what I have...  not quite working..

 

mysql_query("SELECT DISTINCT d.position, o.position, k.position, q.position FROM football_q AS q, football_d AS d, football_o AS o, football_k AS k WHERE d.userID='$userID' OR o.userID='$userID' OR k.userID='$userID' OR q.userID='$userID'");

 

Can Anyone tell me what I am doing wrong or is this even possible? 

I am trying to return a position if it is in the DB but if there are 7 QB's I just want it to list one... Hence the distinct

 

Thanks for your help!

J

Link to comment
Share on other sites

I am trying to populate a dropdown menu for "positions"

 

They positions that could be populated are in four different tables.

 

So If a user has "position 3" and "position 5" and "position 9" This would grab those positions and place them in a dropdown menu so they can choose the one they want to view,...

 

The problem comes in that they psitions can be in any one of four tables and there could be multiple entries, ie. "position 3" could be in table 4 times, but I only want one displayed!

 

I know, it is as clear as mud!  Hope this hels though!

Thanks

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.