Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 两个不同表上的DISTINCT关键字';内容_Sql_Sql Server - Fatal编程技术网

Sql 两个不同表上的DISTINCT关键字';内容

Sql 两个不同表上的DISTINCT关键字';内容,sql,sql-server,Sql,Sql Server,我们可以在完全外部联接创建的两个不同表的内容上使用DISTINCT关键字吗?是的,甚至可以在三个表上使用DISTINCT关键字: select distinct t1.id, t2.col1, t3.col1 from table1 t1 full outer join table2 t2 on t1.id = t2.t1_id full outer join table3 t3 on t1.id = t3.t1_id 是的,您可以使

我们可以在完全外部联接创建的两个不同表的内容上使用DISTINCT关键字吗?是的,甚至可以在三个表上使用DISTINCT关键字:

select  distinct t1.id, t2.col1, t3.col1
from    table1 t1
full outer join
        table2 t2
on      t1.id = t2.t1_id
full outer join
        table3 t3
on      t1.id = t3.t1_id

是的,您可以使用DISTINCT,只需从结果集中删除任何重复项。