我有一个非常简单的问题,我无法解决.我需要做这样的事情:
I have very simple problem that I can't solve. I need to do something like this:
select distinct * from (1, 1, 1, 2, 5, 1, 6).
有人可以帮忙吗??
编辑
数据来自我们的一位客户的文本文件.它完全没有格式化(它是一行很长的文本),但在 Excel 中可能会这样做.但这对我来说并不实用,因为我需要在我的 sql 查询中使用这些值.每次需要运行查询时都这样做很不方便.
The data comes as a text file from one of our clients. It's totally unformatted (it's a single, very long line of text), but it may be possible to do so in Excel. But it's not practical for me, because I will need to use these values in my sql query. It's not convenient to do so every time I need to run a query.
获取一长串逗号分隔文本的不同值的最简单方法是使用 find an replace with UNION 以获得不同的值.
Simplest way to get the distinct values of a long list of comma delimited text would be to use a find an replace with UNION to get the distinct values.
SELECT 1
UNION SELECT 1
UNION SELECT 1
UNION SELECT 2
UNION SELECT 5
UNION SELECT 1
UNION SELECT 6
应用于您的逗号分隔文本的长行
Applied to your long line of comma delimited text
UNION SELECT
SELECT
您现在应该有一个有效的查询
You now should have a working query
这篇关于如何从 SQL Server 中的值列表中进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!