skip to main
|
skip to sidebar
豆腐鍋 :: Tofu Steamboat
Social Icons
Pages
首頁
2018年3月12日 星期一
How to select top 1 record per group
抓取客戶最後一次購買此產品的日期
SELECT product, cus, date
FROM (
SELECT product,
cus,
date,
row_number() over (partition by
product
,
cus
order by
date
desc) as ranker
FROM SalesTable
) z
WHERE
ranker = 1
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
Popular Posts
技術提供:
Blogger
.
Labels
CentOS
cmd
Excel
JDE
Julian Date
MSSQL
MySQL
Power Query
Remote Desktop
SQL
SSL
SSLS
xrdp
Blog Archive
►
2019
(1)
►
1月
(1)
▼
2018
(7)
►
11月
(1)
►
9月
(1)
►
8月
(3)
►
5月
(1)
▼
3月
(1)
How to select top 1 record per group
►
2017
(11)
►
12月
(1)
►
10月
(3)
►
9月
(2)
►
7月
(2)
►
6月
(3)
沒有留言:
張貼留言