Assuming that we have the following MySQL table:
ID | Name | Last_Name | Location |
1 | Alex | Griff | DT |
2 | John | Doe | York |
3 | Pat | Benat | DT |
4 | Jack | Darny | DT |
5 | Duff | Hill | York |
I want to create an sql statement that selects randomly one row of each location and store them in a new table.
For example:
2 | John | Doe | York |
3 | Pat | Benat | DT |
OR
4 | Jack | Darny | DT |
5 | Duff | Hill | York |
I would like to execute this on SQL since it's much faster than doing it on a Java program and using HashMap<K,V>
and then storing the values again in another table.