I have a table showing available dates for some staff with two fields - staffid and date with information that looks :`
staffid date
1 2016-01-01
1 2016-01-02
1 2016-01-03
2 2016-01-03
3 2016-01-01
3 2016-01-03
I need to generate a list of distinct available dates from this table, where the staff selected to each date is selected randomly. I know how to select rows based on one distinct field, (see for example the answer here, but this will always select the rows based on a given order in the table (so for example staff 1 for January 1, while I need selection to be random so sometimes 1 will be selected as the distinct row and sometimes staff 3 will be selected.
The result needs to be ordered by date.
Aucun commentaire:
Enregistrer un commentaire