在ms访问中按随机列分组

时间:2018-07-25 22:07:03

标签: sql ms-access

我在MS ACCESS SQL中需要这样的东西

SELECT 
    ID, 
    col1, 
    col2, 
    random(col3) 
FROM 
    table
GROUP BY
    ID, 
    col1, 
    col2

注意:

我想删除选择col3随机值的重复项。

输入:

+----+------+------+------+
| Id | col1 | col2 | col3 |
+----+------+------+------+
| 1  | A    | B    | 7    |
+----+------+------+------+
| 1  | A    | B    | 10   |
+----+------+------+------+

结果:

+----+------+------+------+
| Id | col1 | col2 | col3 |
+----+------+------+------+
| 1  | A    | B    | 7    |
+----+------+------+------+

请求:

+----+------+------+------+
| Id | col1 | col2 | col3 |
+----+------+------+------+
| 1  | A    | B    | 10   |
+----+------+------+------+

0 个答案:

没有答案