次のことを前提とします。
CREATE TABLE #Testing
(
[id] [int] IDENTITY(1,1) NOT NULL,
[store_id] [varchar](3) NULL,
[sku] [varchar](14) NULL,
[qty] [bigint] NULL,
[http_action] [varchar](20) NULL
)
INSERT INTO #Testing (store_id, sku, qty, http_action)
SELECT '001','123456',1,'POST'
UNION ALL
SELECT '002','123456',1,'POST'
UNION ALL
SELECT '002','123456',1,'DELETE'
UNION ALL
SELECT '001','223456',5,'DELETE'
[http_action] ごとに最小の [id] を返すために実行できる単一のクエリは何ですか? 何かのようなもの:
MIN_DELETE MIN_POST
3 1
GO