سؤال

In my Database I have a column "length" from type TIME where the values are like 02:20:00 but I want them all to be 00:02:20

Is there any way to do? I have over 5000 rows so I can't change it with UPDATE.

هل كانت مفيدة؟

المحلول

update your_table
set length = time(concat('00:', hour(length), ':', minute(length)))

SQLFiddle demo

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top