-5

这些是我的简化表..

person
( id [int],
  surname [varchar] (30),
  ref [int],
)

episode
(
  id [int],
  ref [int],
  typeId [int],
  startDate [datetime]
)

type
(
  typeId [int],
  typeName [varchar]
)

我想选择所有有超过 1 集的人,并且最早的一集从 2013 年 1 月 1 日之后开始。我尝试使用 Row_Number 和分区,但我使用的是 Sql Server 2005,它不喜欢 Row_Number()。

4

1 回答 1

3

利用:

having count(*)>1
and min(startDate) >'1 Jan 2013'

编辑:下面的评论是对的

于 2013-07-22T12:59:07.693 回答