MySQL join troubles!

wxdqz

New Member
Hi all,

I am struggling with a join statement, is it possible to do this:

table - great
This table holds a static list of people to vote for:
id | game | sex | name | votes | updated
------------------------------------------------------------
1 | 1 | M | Mike | 14 | 20010917
2 | 1 | M | Nigel | 6 | 20010917
3 | 1 | F | Angie | 12 | 20010917
4 | 1 | F | Julie | 8 | 20010917

table - entries
Entrants vote for 1 male & 1 female (m & f) where the number in m/f is the id from above:
id | game | name | m | f | date
-------------------------------------------------------
1 | 1 | Mr.Jones | 1 | 3 | 20010917
2 | 1 | Mr.Smith | 2 | 3 | 20010917
3 | 1 | Mrs.Mop | 2 | 4 | 20010917
4 | 1 | Mr.Magoo | 1 | 4 | 20010917
etc...

I need to output a text file which shows the following:

1,1,Mr.Jones,Mike,Angie,20010917
2,1,Mr.Smith,Nigel,Angie,20010917
3,1,Mrs.Mop,Nigel,Julie,20010917
4,1,Mr.Magoo,Mike,Julie,20010917
etc...

Any ideas would be much appreciated!

Hope this makes sense

TIA

Mike
 
Back
Top