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. Link to comment https://forums.phpfreaks.com/topic/111689-multiple-update-query-help/ Share on other sites More sharing options...
fenway Posted June 24, 2008 Share Posted June 24, 2008 You can use a CASE statement. Link to comment https://forums.phpfreaks.com/topic/111689-multiple-update-query-help/#findComment-573430 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. Link to comment https://forums.phpfreaks.com/topic/111689-multiple-update-query-help/#findComment-573443 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). Link to comment https://forums.phpfreaks.com/topic/111689-multiple-update-query-help/#findComment-573518 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.. Link to comment https://forums.phpfreaks.com/topic/111689-multiple-update-query-help/#findComment-573550 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.