模板1: update 表1 set 表1.字段1 = ( select 表1字段或者表2字段 from 表2 where 表1主键 = 表2外键 及其他条件 ) where 表1.字段 = ? 样例1: UPDATE sr_main aSET a.main_xm_nam05 = ( SELECT count(1) FROM sr_detail b WHERE a.pk_sr_main = b.fk_sr_main AND detail_bz_sad06 IN ('1', '2', '3…
declare ) ) --获取表的列名 ,),filename INTO #templist FROM (select cl.name as filename from sys.tables AS tb,sys.columns cl where tb.object_id = cl.object_id and tb.name='book') AS A SELECT @intMinId =MIN(RowID),@intMaxId=MAX(RowID) FROM #templist --这里必须设置…
select client.clientname ,description,'client2'= case when client.Description IS NULL then client.clientname when ltrim(rtrim(client.Description))='' then client.clientname else client.clientname +' - '+ client.Description end from T_CSC_ClientMaste…