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
https://forums.phpfreaks.com/topic/185798-distinct-with-a-join-is-it-possible/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.