Ronak Patel
Ronak Patel

Reputation: 3444

How to do Base64 decode and Lower in single mysql query?

I am stucked in one of MySQl query. I want two process on one field. Let say the field is named 'title'. Now title has BASE64_encoded data in it. Now I want to fetch all the data in lower case with mysql. I tried below code. but I didnt get my result. Hope you help me.

SELECT LOWER(FROM_BASE64(title)) as title FROM my_table;

I know, both are working individually. but not together. Now How can I do both process in one mysql.

Upvotes: 2

Views: 3442

Answers (2)

Ronak Patel
Ronak Patel

Reputation: 3444

I found solution.

SELECT LOWER(CONVERT(FROM_BASE64(title) USING latin1)) as title FROM my_table;

Upvotes: 6

Rahul Tripathi
Rahul Tripathi

Reputation: 172548

You can try like this:

SELECT LOWER(X) as title FROM (select FROM_BASE64(title) as X from my_table);

Upvotes: 1

Related Questions