CREATE TABLE ntile_usage (
ID INT NOT NULL
);
INSERT INTO ntile_usage(ID)
VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
SELECT * FROM ntile_usage;
declare @p int = 4
SELECT
ID,
NTILE (@p) OVER (
ORDER BY ID
) GroupIDs
FROM
ntile_usage;
ID INT NOT NULL
);
INSERT INTO ntile_usage(ID)
VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
SELECT * FROM ntile_usage;
declare @p int = 4
SELECT
ID,
NTILE (@p) OVER (
ORDER BY ID
) GroupIDs
FROM
ntile_usage;
No comments:
Post a Comment