TSQL中的join语句共有五种类型,left join,right join,inner join,full join,cross join 为了描述方便,解释一个名词"保留表",在进行连接查询时,保留表中的数据行全部显示出来. 首先创建测试使用的代码 create table dbo.ta ( a int, b int ) create table dbo.tb ( ca int, cb int ) go insert into dbo.ta ,),(,) insert into…
MERGE INTO 语法: MERGE INTO table_name alias1 USING (table|view|sub_query) alias2ON (join condition) WHEN MATCHED THEN UPDATE table_name SET col1 = col_val1, col2 = col2_val WHEN NOT MATCHED THEN INSERT (column_list) VALUES (column_values);…