62,267
社区成员
发帖
与我相关
我的任务
分享
select * from tbs
CategoryID Name Description row
2 Birthdays Tell someone "Happy Birthday" with one of these wonderful balloons! 1
5 Cartoons Buy a balloon with your child's favorite cartoon character! 2
1 Love & Romance Here's our collection of balloons with romantic messages. 3
4 Message Balloons Why write on paper, when you can deliver your message on a balloon? 4
6 Miscellaneous Various baloons that your kid will most certainly love! 5
3 Weddings Going to a wedding? Here's a collection of balloons for that special event! 6
select * from tbs where row=(select row+1 from tbs where CategoryID=5)
CategoryID Name Description row
1 Love & Romance Here's our collection of balloons with romantic messages. 3
CategoryID Name Description
1 Love & Romance Here's our collection of balloons with romantic messages.
2 Birthdays Tell someone "Happy Birthday" with one of these wonderful balloons!
3 Weddings Going to a wedding? Here's a collection of balloons for that special event!
4 Message Balloons Why write on paper, when you can deliver your message on a balloon?
5 Cartoons Buy a balloon with your child's favorite cartoon character!
6 Miscellaneous Various baloons that your kid will most certainly love!
WITH tbs AS
(
SELECT [CategoryID]
,[Name]
,[Description]
,ROW_NUMBER() OVER(ORDER BY [Name]) as row
FROM [Category]
)
select * from tbs where row=(select row-1 from tbs where CategoryID=5)