私は次を持っています:
USE xxx
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[branches](
[branchNumber] [int] NULL,
[isSub] [char](1) NULL,
[masterBranch] [int] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
insert into branches
values ( 115, 'Y', 900 )
insert into branches
values ( 123, 'Y', 900 )
insert into branches
values ( 150, 'Y', 900 )
insert into branches
values ( 900, 'N', null )
insert into branches
values ( 901, 'N', null )
go
チェックする必要がありますa)115 a isSub = Yですか?もしそうなら、私は115を返します。b)900はIsSub = Yですか?そうでない場合は、115、123、150、900を返す必要があります。c)901 a isSub = Y?そうでない場合は、901を返す必要があります。
ランク()関数を見てからかなり時間が経っているので、今はちょっと行き詰まっています。どんな助けでもありがたいです。ありがとう