I got a problem on updating column from another column in same table. I know this question is duplicate. But here is the situation. I have this table structure:
  login   |   card_id   | card_serial
--------------------------------------
  A1149     1446700898    NULL
  A672      1446845746    NULL
  A626      1446581746    NULL
Now, I want to update card_serial column with hex value using hex function. The data supposed to be like this:
  login   |   card_id   | card_serial
--------------------------------------
  A1149     1446700898    62E73A56
  A672      1446845746    321D3D56
  A626      1446581746    F2153956
But when I try to update card_serial column with my SQL statement, it always return value 36343431.
This is my statement:
UPDATE card_id_without_serial a 
JOIN card_id_without_serial b ON b.login = a.login
SET a.card_serial = concat(substring(hex(b.card_id), 7,2), substring(hex(b.card_id), 5,2), substring(hex(b.card_id), 3,2), substring(hex(b.card_id), 1,2));
Please help me and thank you
