例如--
select * into tc
from shopentinfo2
inner join workstudyinfo2
on shopentinfo2.familyid=workstudyinfo2.familyid and shopentinfo2.memberid=workstudyinfo2.memberid
where shopentinfo2.familyid like 'd%' and shopentinfo2.acttype=1 and shopentinfo2.经度>0
报错说有列名重复(即familyid memberid),因此无法写入tc。
怎么让它自动的不输出重复列?
select * into tc
from shopentinfo2
inner join workstudyinfo2
on shopentinfo2.familyid=workstudyinfo2.familyid and shopentinfo2.memberid=workstudyinfo2.memberid
where shopentinfo2.familyid like 'd%' and shopentinfo2.acttype=1 and shopentinfo2.经度>0
报错说有列名重复(即familyid memberid),因此无法写入tc。
怎么让它自动的不输出重复列?
把需要的字段都写上
from tb1 inner join tb2 on
select distinct * into tc
from shopentinfo2
inner join workstudyinfo2
on shopentinfo2.familyid=workstudyinfo2.familyid and shopentinfo2.memberid=workstudyinfo2.memberid
where shopentinfo2.familyid like 'd%' and shopentinfo2.acttype=1 and shopentinfo2.经度>0
一个一个写上所有字段,有点麻烦,因为经常做各种join。
没有更快的方法吗?