怎么才能让列不能重复啊 急!!!急!!!急!!! select distinct(i.inStoreNO) inStoreNO,
i.inStoreID,
st.storeName,
st.storeID store,
u.userName storeAdmin,
sp.supplierName supplier,
inDate
from InStore i
left join Store st on i.store=st.storeID
left join [User] u on i.storeAdmin=u.userID
left join Supplier sp on i.supplier=sp.supplierID
where 1=1 and i.store=15 and i.supplier=41 Order By inDate DESC
分享到:更多
------解决方案--------------------
这次应该行了,能多给点分不:
select inStoreNO,inStoreID,storeName,store,storeAdmin,supplier,inDate
from
(
select i.inStoreNO inStoreNO,
i.inStoreID,
st.storeName,
st.storeID store,
u.userName storeAdmin,
sp.supplierName supplier,
inDate,
ROW_NUMBER() over(PARTITION by i.inStoreNO order by getdate()) rownum
from InStore i