如何 select 一次不同的列并空白到其相似的 id 列
How to select distinct column once and blank to its similar id column
我想要这样的结果
Dept Name EmployeeCount
IT Ankit 4
Aman 4
Rakesh 4
Rohhit 4
HR Deepak 3
Manoj 3
Raj 3
你可以在这里使用window函数-
SELECT CASE WHEN Dept = LAG(Dept) OVER() THEN NULL ELSE Dept END Dept
,Name
,COUNT(Name) OVER() EmployeeCount
FROM YOUR_TABLE;
我想要这样的结果
Dept Name EmployeeCount
IT Ankit 4
Aman 4
Rakesh 4
Rohhit 4
HR Deepak 3
Manoj 3
Raj 3
你可以在这里使用window函数-
SELECT CASE WHEN Dept = LAG(Dept) OVER() THEN NULL ELSE Dept END Dept
,Name
,COUNT(Name) OVER() EmployeeCount
FROM YOUR_TABLE;