I've got the following result when I tried to fetch the results from the database with mysql command :
select player_id,full_name,club_name from players
something like that :
+----+------+---------------------+
| id | full_name | club_name |
+----+------+---------------------+
| 1 | Ahmed Sayed | El Ahly |
+----+------+---------------------+
| 2 | Kareem Gaber | El Ahly |
+----+------+---------------------+
| 3 | Wael Gamal | ENPPI |
+----+------+---------------------+
| 4 | Mohab Saeed | Petrojet |
+----+------+---------------------+
| 5 | Kamal saber | Cocorico |
+----+------+---------------------+
| 6 | Mohamed mezo | Ismaily |
+----+------+---------------------+
| 7 | Mohamed gad | Ismaily |
+----+------+---------------------+
| 8 | moaz maged | Smouha |
+----+------+---------------------+
but I have many club names similar to above
+----+------+---------------------+
| 1 | Ahmed Sayed | El Ahly |
+----+------+---------------------+
| 2 | Kareem Gaber | El Ahly |
+----+------+---------------------+
OR
+----+------+---------------------+
| 6 | Mohamed mezo | Ismaily |
+----+------+---------------------+
| 7 | Mohamed gad | Ismaily |
+----+------+---------------------+
and I have tried to use ORDER BY RAND(club_name)
and it gave me a result like that
Ex:
+----+------+---------------------+
| id | full_name | club_name |
+----+------+---------------------+
| 1 | Ahmed Sayed | El Ahly |
+----+------+---------------------+
| 2 | Kareem Gaber | Petrojet |
+----+------+---------------------+
| 3 | Wael Gamal | ENPPI |
+----+------+---------------------+
| 4 | Mohab Saeed | El Ahly |
+----+------+---------------------+
| 5 | Kamal saber | Cocorico |
+----+------+---------------------+
| 6 | Mohamed mezo | Ismaily |
+----+------+---------------------+
| 7 | Mohamed gad | Ismaily |
+----+------+---------------------+
| 8 | moaz maged | Smouha |
+----+------+---------------------+
The desired output would be:
+----+------+---------------------+
| id | full_name | club_name |
+----+------+---------------------+
| 1 | Ahmed Sayed | El Ahly |
+----+------+---------------------+
| 2 | Kareem Gaber | Petrojet |
+----+------+---------------------+
| 3 | Wael Gamal | ENPPI |
+----+------+---------------------+
| 4 | Mohab Saeed | El Ahly |
+----+------+---------------------+
| 5 | Kamal saber | Cocorico |
+----+------+---------------------+
| 6 | Mohamed mezo | Ismaily |
+----+------+---------------------+
| 7 | Mohamed gad | Cocorico |
+----+------+---------------------+
| 8 | moaz maged | Smouha |
+----+------+---------------------+
can mysql do that or should I integrate php with mysql ? Any help would be much appreciated.
Aucun commentaire :
Enregistrer un commentaire