是否有更好/更高效/更短的寫這個SQL查詢方式:寫入多個更新更有效的方式查詢
UPDATE mTable SET score = 0.2537 WHERE user = 'Xthane' AND groupId = 37;
UPDATE mTable SET score = 0.2349 WHERE user = 'Mike' AND groupId = 37;
UPDATE mTable SET score = 0.2761 WHERE user = 'Jack' AND groupId = 37;
UPDATE mTable SET score = 0.2655 WHERE user = 'Isotope' AND groupId = 37;
UPDATE mTable SET score = 0.3235 WHERE user = 'Caesar' AND groupId = 37;
請注意,某些建議的解決方案有可能更新比原始更多的行,並用NULL替換現有評分值,而原始語句不會這樣做。 – spencer7593 2012-07-27 15:17:19
可以改變用戶數量嗎?或組的數量?這個查詢是否會動態構建?或者是更新常數,只有分數改變? – 2012-07-27 15:57:03