jeudi 17 mars 2016

How Select Random with parent_id in mysql?

I have table like this...

| id | text | parent_id |
1 | test | 1 |
2 | asd | 1 |
3 | dsa | 1 |
4 | fgh | 4 |
5 | jkl | 4 |
6 | kkk | 4 |
7 | asas | 7 |

how to get random output like :

| id | text | parent_id |
4 | fgh | 4 |
5 | jkl | 4 |
6 | kkk | 4 |
7 | asas | 7 |
1 | test | 1 |
2 | asd | 1 |
3 | dsa | 1 |

or

7 | asas | 7 |
4 | fgh | 4 |
5 | jkl | 4 |
6 | kkk | 4 |
1 | test | 1 |
2 | asd | 1 |
3 | dsa | 1 |

and etc....




Aucun commentaire:

Enregistrer un commentaire