There is a strange behaviour with HeidiSQL (version is 9.5.0). I would like to collect with UNION two selects. If one select contains COUNT(*)
and the other correspoding columns has character the character is converted to hexadecimal (see coloumn 1):
SELECT 'a' c1, 1 c2, NULL c3, 'b' c4
UNION
SELECT COUNT(*) c1, COUNT(*) c2, COUNT(*) c3, CAST(COUNT(*) AS CHAR) c4
-- OUTPUT
-- HEX(n) c2 c3 c4
-- 0x61 1 \N 'b'
-- 0x31 1 1 1
As soon COUNT(*)
is used the string is converted. This is not the case if I submit on the console and in older version of HeidiSQL.
Any idea how can I avoid this behaviour? I could convert COUNT(*)
to string as in column 4, but maybe there is a solution without this hack.