select DISTINCT column1, (select DISTINCT column2 from table1 ) from table1
从table1中选择DISTINCT column1(从table1中选择DISTINCT column2)
I want both column1 and column2 value without duplicate
我想要column1和column2值都没有重复
4 个解决方案
#1
1
SELECT DISTINCT value FROM Table1 CROSS APPLY ( VALUES ('COLUMN1', Column1), ('COLUMN2', Column2) ) c(col, value) WHERE value IS NOT NULL
SELECT DISTINCT值FROM Table1 CROSS APPLY(VALUES('COLUMN1',Column1),('COLUMN2',Column2))c(col,value)WHERE值IS NOT NULL
#2
0
select distinct column1
,column2
from table1
#3
0
If you have only few duplicates, then
如果你只有很少的重复,那么
SELECT DISTINCT Column1, Column2 from table1
If you have many duplicates, then
如果你有很多重复,那么
SELECT Column1, Column2 from table1 GROUP BY Column1, Column2
#4
0
select distinct column1,column2 from table1;
从table1中选择distinct column1,column2;
#1
1
SELECT DISTINCT value FROM Table1 CROSS APPLY ( VALUES ('COLUMN1', Column1), ('COLUMN2', Column2) ) c(col, value) WHERE value IS NOT NULL
SELECT DISTINCT值FROM Table1 CROSS APPLY(VALUES('COLUMN1',Column1),('COLUMN2',Column2))c(col,value)WHERE值IS NOT NULL
#2
0
select distinct column1
,column2
from table1
#3
0
If you have only few duplicates, then
如果你只有很少的重复,那么
SELECT DISTINCT Column1, Column2 from table1
If you have many duplicates, then
如果你有很多重复,那么
SELECT Column1, Column2 from table1 GROUP BY Column1, Column2
#4
0
select distinct column1,column2 from table1;
从table1中选择distinct column1,column2;