Jump to content
Sign in to follow this  
smigl

Multiple Update Data Problem

Recommended Posts

Hi, i have an idea how to update my product prices faster directly using Query then manual opening 1by1 item in my admin page. but here is problem... I need to update multiple items with diffrent values. here is how table looks like SELECT TOP 1000 [id] ,[name] ,[itemno] ,[description] ,[smallimage] ,[largeimage] ,[price] ,[shortdesc] ,[active] ,[feature] ,[saleprice] ,[onsale] ,[search] ,[qty] ,[addqty] ,[imgresize] ,[hideprice] ,[hidehead] ,[weight] ,[digital] ,[digfile] ,[pgvisits] ,[pgvisitson] ,[taxable] ,[custom1] ,[custom2] ,[custom3] ,[imgwrap] ,[shipping] FROM [YRHR_PD_SHOP].[dbo].[items] now i want to change price and saleprice of items linkin it to itemno here is what i did to change 1 data UPDATE dbo.itemsSET price='10.20', saleprice='9.90', onsale='YES'WHERE itemno='68418' now how do i do it for multiple data, problem is that itemno, price and saleprace are all diffrent for every entry.for example UPDATE dbo.itemsSET price='10.20', saleprice='9.90', onsale='YES'WHERE itemno='68418';SET price='109.20', saleprice='67.90', onsale='YES'WHERE itemno='24507';SET price='156.20', saleprice='23.90', onsale='YES'WHERE itemno='22567' can anybody help? thank you.

Share this post


Link to post
Share on other sites

well this worked... stupid me :( UPDATE dbo.itemsSET price='10.20', saleprice='9.90', onsale='Yes'WHERE itemno='68418'UPDATE dbo.itemsSET price='99.90', saleprice='65.90', onsale='Yes'WHERE itemno='24507' is there any better solutio?

Share this post


Link to post
Share on other sites

That's the way to do it. If you're running this on SQL Server you can separate the queries with semicolons and send the batch to the server at once.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...