Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

update query

$
0
0

DECLARE@OriginalTable TABLE(serialNo INT IDENTITY(1,1),Itemcode CHAR(4),Expirydate DATETIME,qty INT,avgprice INT)INSERT@OriginalTable SELECT'A','2013-12-15 10:09:59.237',9,100INSERT@OriginalTable SELECT'B','2013-12-14 10:09:59.237',19,1000DECLARE@DataImported_Excel TABLE(Itemcode CHAR(4),varientqty INT)INSERT@DataImported_Excel SELECT'A',10INSERT@DataImported_Excel SELECT'B',20--before updateSELECT*FROM@OriginalTableUPDATE A SET A.qty = B.qtyFROM@OriginalTable AJOIN@DataImported_Excel B ON A.Itemcode = B.ItemcodeHere I have duplicated Itemcode based up on the expirydate. So I want to update the top expirydate itemcode of originaltable

so kindly alter the above update query--after updateSELECT*FROM@OriginalTable


AK


Viewing all articles
Browse latest Browse all 14337


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>