如何在变量中区分
let mimeTypes = [
"video/mp4", "video/3gpp", "video/quicktime"
, "video/x-ms-wmv", "video/x-msvideo", "video/mpeg"
, "video/dvd", "video/xvid", "video/x-flv"
, "video/x-f4v", "video/divx"
];
let video = document.createElement("video");
mimeTypes.forEach(type => console.log(type, video.canPlayType(type)));
答案 0 :(得分:1)
可以分三步完成
查询链接
第1步:Turning a Comma Separated string into individual rows
第2步:从上面的结果中选择Distinct
第3步:Simulating group_concat MySQL function in Microsoft SQL Server 2005?
答案 1 :(得分:0)
你可以在这里找到解决方案, https://blog.sqlauthority.com/2009/01/15/sql-server-remove-duplicate-entry-from-comma-delimited-string-udf/
答案 2 :(得分:0)
以下是使用内存表解决此问题的解决方案。
DECLARE @var NVARCHAR(500)
SELECT @var = 'EQUITY,EQUITY,EQUITY,EQUITY,EQUITY,EQUITY,EQUITY,DEBT,DEBT,DEBT,DEBT,DEBT,DEBT,DEBT,DEBT,DEBT,DEBT,DEBT,DEBT'
DECLARE @tempTable TABLE (items NVARCHAR(500))
DECLARE @distinctTable TABLE (items NVARCHAR(500))
DECLARE @delimiter CHAR(1) = ',' --- Specify the delimiter
DECLARE @idx INT
DECLARE @section NVARCHAR(500)
DECLARE @ouput NVARCHAR(500)
SELECT @idx = 1
IF LEN(@var)<1 OR @var IS NULL RETURN
WHILE @idx!= 0
BEGIN
SET @idx = CHARINDEX(@delimiter,@var)
IF @idx!=0
SET @section = LEFT(@var,@idx - 1)
ELSE
SET @section = @var
IF(LEN(@section)>0)
INSERT INTO @tempTable(Items) VALUES(@section)
SET @var = RIGHT(@var,LEN(@var) - @idx)
IF LEN(@var) = 0 BREAK
END
INSERT @distinctTable (items)
SELECT DISTINCT * FROM @tempTable
SET @ouput = ''
SELECT @ouput = @ouput + items + @delimiter FROM @distinctTable
SELECT SUBSTRING(@ouput, 0, LEN(@ouput))