我有一个列表如下:
A= {[1 2], [2 1], [2 1 3],[3 4],[4 3]}
Run Code Online (Sandbox Code Playgroud)
我需要简化矩阵.例如,[3 4]并[4 3]形成相同的组合,其中只有一个就足够了.此外,[1 2]和[2 1]是相同的组合,所以我应该留下
newA= {[1 2],[2 1 3],[3 4]}
Run Code Online (Sandbox Code Playgroud)
我怎么做?
我的表中有两列。表名是用inner join和group by构造的,我们称这个表为Joined。它有两列Present和Score。如果Present为 null,那么我想将 0 赋给该Score值。
+------------+--------+-------------+------------+--------+
| Student_Id | Course | ExamDate | Present | Score |
+------------+--------+-------------+------------+--------+
| 1 | Math | 04/05/2020 | Yes | 45 |
| 2 | Math | 04/05/2020 | NULL | 90 |
| 2 | Math | 04/05/2020 | NULL | 50 |
+------------+--------+-------------+------------+--------+
Run Code Online (Sandbox Code Playgroud)
我现在所拥有的是
SELECT DISTINCT StudentID ,Course, ExamDate, Present, Score
CASE Present ISNULL
Score = 0
END
FROM Joined …Run Code Online (Sandbox Code Playgroud)