Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个返回以下数据的查询
正如您在图像中看到的那样,彩色组对于“A”列是相似的,我想将这些行的第一次出现与“A”列相关,并丢弃其余的。
所以我可以得到这个结果。
任何解决方案?
谢谢 :)
更新:
这是原始查询结果
我会这样做:
WITH T(A, B, C, D, RowNum) AS ( SELECT A, B, C, D, ROW_NUMBER() OVER (PARTITION BY A ORDER BY A) FROM MyTable ) SELECT * FROM T WHERE RowNum = 1