Forum Moderators: mack
My Mysql database contains three fields
id-game-player
1-football-tim
2-football-jim
3-baseball-kim
4-baseball-gim
5-basketball-ali
6-basketball-kali
how should i write a query so that it should print the players coming under particular game i.e.
Football
Tim
Jim
Baseball
Kim
Gim
basketball
ali
kali
Thanks
HS
This is corrected question:
SELECT player, game FROM table GROUP BY game, player;
It will even return twice players that are playing football and basketball, however it will ommit records where player and game already appeared:
id-game-player
1-football-tim
2-football-jim
3-baseball-kim
4-baseball-gim
5-basketball-ali
6-basketball-kali
7-basketball-kali
will return
Football
Tim
Jim
Baseball
Kim
Gim
basketball
ali
kali
Hope it helps you somehow!