user2888996
user2888996

Reputation: 427

Mysql AES_DECRYPT() and Replace function Together?

i am trying to replace the message and also decryption of message, i tried the query:

select 
   aes_decrypt(message,'Password')as message,
   replace(message,'#TD1#','\n\n') as message   
from 
  daily 
limit 1;

but it is returning 2 columns.

Upvotes: 0

Views: 107

Answers (2)

naveen goyal
naveen goyal

Reputation: 4629

Try This

SELECT REPLACE(AES_DECRYPT(message, 'Password'), '#TD1#', '\n\n') AS message 
FROM   daily 
LIMIT  1; 

Upvotes: 1

Mad Dog Tannen
Mad Dog Tannen

Reputation: 7242

You have 2 columns in the select, both of them named message also. Try it like this

 SELECT REPLACE(AES_DECRYPT(message,'Password'), '#TD1#','\n\n' ) Message
 FROM daily 
 LIMIT 1;

or

 SELECT AES_DECRYPT(REPLACE(message, '#TD1#','\n\n' ),'Password') Message
 FROM daily 
 LIMIT 1;

Upvotes: 0

Related Questions