go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

mysql sum return err

Open lvphpwb opened this issue 5 months ago • 2 comments

SELECT sum(total) FROM user WHERE xxxxxx=xxx

sql: Scan error on column index 0, name "sum(total)": converting NULL to uint64 is unsupported

lvphpwb avatar Jun 13 '25 02:06 lvphpwb

When there is no matching data in the table

lvphpwb avatar Jun 13 '25 02:06 lvphpwb

use sql.NullInt64 instead

kesonan avatar Jun 14 '25 15:06 kesonan

thanks

lvphpwb avatar Oct 30 '25 06:10 lvphpwb