我有这张桌子:
CREATE TABLE [dbo].[Phrase]
(
[PhraseId] UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
[English] NVARCHAR(250) NOT NULL,
[Romaji] NVARCHAR(MAX) NULL
)
我尝试向English
列添加唯一索引但由于存在重复项而失败。我怎样才能找出哪些是重复的?
答案 0 :(得分:0)
嵌套查询查找2行或更多行中的 public function __construct($name, Filesystem $filesystem, CDNInterface $cdn, GeneratorInterface $pathGenerator, ThumbnailInterface $thumbnail, array $allowedExtensions = array(), array $allowedMimeTypes = array(), ResizerInterface $resizer, MetadataBuilderInterface $metadata = null, Container $container, EntityManager $entityManager) {
...
$this->container = $container;
$this->ffmpeg = FFMpeg::create([
'ffmpeg.binaries' => $this->container->getParameter('xmon_ffmpeg.binary'),
'ffprobe.binaries' => $this->container->getParameter('xmon_ffprobe.binary'),
'timeout' => $this->container->getParameter('xmon_ffmpeg.binary_timeout'),
'ffmpeg.threads' => $this->container->getParameter('xmon_ffmpeg.threads_count')
]);
$this->ffprobe = FFProbe::create([
'ffmpeg.binaries' => $this->container->getParameter('xmon_ffmpeg.binary'),
'ffprobe.binaries' => $this->container->getParameter('xmon_ffprobe.binary')
]);
...
}
值。外部查询返回嵌套查询中具有English
值的行。
此处需要嵌套查询,因为您可能希望获得English
,如果PhraseId
获取重复值,则group by English
将丢失。
PhraseId
答案 1 :(得分:0)
;With dupes
as
(select *,row_number() over (partition by english order by (select null)) as rownum
from table)
select * from cte where rownum>1