UPDATE Product
SET ProductCategoryCode = o.ProductCategory
FROM OldProduct o JOIN Product p
ON o.SerialNumber = p.SerialNumber
http://social.msdn.microsoft.com/Forums/zh-TW/ec192db7-d8f9-42f4-b179-adbfdf90e5b2/sql?forum=238
select a.*,b.amount
from view_backpackinfo a
inner join (
SELECT item_id,username,SUM(amount) as amount
FROM view_backpackinfo
group by item_id,username
) b on a.item_id = b.item_id and a.username = b.username
沒有留言:
張貼留言