简体   繁体   中英

Mysql update table with max value from another table with inner join

update cle c set c.dme_id = (
    select max(serial_number) from cle_dme_id a where cast(
        a.dme_id as decimal(7,4)
    )<=cast(
        c.dme_id as decimal(7,4)
    )
);

It's not working, and that is the error:

Error Code: 1264. Out of range value for column '(null)' at row 1

I found out that the decimal(7,4) was causing the problem. After replacing it with decimal(10,4) it worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM