1.select * from tbm_o_contract where c_change_type='终止' and c_status='已生效';时间用c_sign_dt与下面的查询组合去重(c_store_id,c_partner)2.select distinct sa.c_store_id,sa.c_partner,sa.c_con_no,e.c_shops_name,f.c_calc_area,sa.c_au_dtfrom tbm_o_backshop saleft join (select t.*from (select a.*, row_number() over(partition by a.c_counter_no order by a.c_version desc) rwfrom tbm_contract a) twhere t.rw = 1) b on sa.c_con_no=b.c_con_noleft join tbm_contract e on sa.c_con_no=e.c_con_noleft join tbm_contract_counter f on sa.c_con_no=f.c_con_nowhere sa.c_status='已审核';3.关联视图获取项目、区域、楼层select a.c_store_name as 项目,a.c_regions as 区域,a.c_floors as 楼层 from dbo.view_contract_info a