ag3nt42 Posted June 24, 2008 Share Posted June 24, 2008 Hello all, I'm trying to write out a multiple UPDATE query to update mutliple rows based on different situations kinda.. let me show u what i mean. I have 7 cols "Sun,Mon,Tues,Wens,Thurs,Fri,Sat" I don't want to have to write out 7 update querys.. So I am wanting to do a multi UPDATE query I'm guessing looks somthing like this UPDATE [dataTable] SET Sun=Open, Mon=Open, Tues=Open, Wens=Open, Thurs=Open, Fri=Open, Sat=Open WHERE id=1 is this useable syntax or ? I duno. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 24, 2008 Share Posted June 24, 2008 You can use a CASE statement. Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted June 24, 2008 Author Share Posted June 24, 2008 could you possibly show me an example.. I've seen a few others but they are only updating one col I need to update many colums.. but only 1 row. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 24, 2008 Share Posted June 24, 2008 Sorry, I missed that... one row? Sure, the statement you wrote is fine (but you need to quote your values). Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted June 24, 2008 Author Share Posted June 24, 2008 ok thanks, i'ma give that a shot.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.