CREATE TABLE t1(a int) engine=innodb; INSERT INTO t1 VALUES (1); SELECT DISTINCT convert((SELECT des_decrypt(2,1) AS a FROM t1 WHERE @a:=1), signed) as d FROM t1 ; d 2 Warnings: Warning 1287 'DES_DECRYPT' is deprecated and will be removed in a future release. Please use AES_DECRYPT instead DROP TABLE t1;