distinct , in 的用法

一、

select distinct address from people where bmname0='樊城区' and bmname='中原派出所' and addrc=''

distinct作用:过滤掉 address 字段中,多余的重复记录,只保留一条(只能过滤一个字段

二、

Update people set addrc=@addrc,addrz=@addrz  Where bmname0='襄城区' and bmname='王府派出所' and addrc='' and address in ('东街二十三号','檀溪西路43号')

in作用:判断给定的值是否在子查询的集合里

三、

Update people set addrc=@addrc,addrz=@addrz  Where bmname0='襄城区' and bmname='王府派出所' and addrc='' and address

in (select distinct address from people where bmname0='樊城区' and bmname='中原派出所' and addrc='')