|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi, sorry for the newbie question. I've one table "my_tapes" with tape_id | tape_title | tape_category I must extract six random tape_titles having different category (so, say we have categories A, B, C, D, E, F, G, H, I need titles with category repetiotion: A, C, E, F, G, H, not A, A, E, E, F, G). How can I do? Thank you! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Oct 17, 3:24 pm, Toy Guy <r...@boy.day> wrote:
> Hi, sorry for the newbie question. > > I've one table "my_tapes" with > > tape_id | tape_title | tape_category > > I must extract six random tape_titles having different category (so, say > we have categories A, B, C, D, E, F, G, H, I need titles with category > repetiotion: A, C, E, F, G, H, not A, A, E, E, F, G). > > How can I do? Thank you! Select Distinct tape_category From my_tapes... |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 17 Oct, 21:16, Andreja <andreja.zivko...@gmail.com> wrote:
> On Oct 17, 3:24 pm, Toy Guy <r...@boy.day> wrote: > > > Hi, sorry for the newbie question. > > > I've one table "my_tapes" with > > > tape_id | tape_title | tape_category > > > I must extract six random tape_titles having different category (so, say > > we have categories A, B, C, D, E, F, G, H, I need titles with category > > repetiotion: A, C, E, F, G, H, not A, A, E, E, F, G). > > > How can I do? Thank you! > > Select Distinct tape_category From my_tapes... No, that won't work. Not sure but try: SELECT * FROM (SELECT * FROM my_tapes ORDER BY RAND())x GROUP BY tape_category ORDER BY RAND() LIMIT 3; |
|
![]() |
| Outils de la discussion | |
|
|