Reputation: 1535
I want to get md5 hash value of mysql result without using php to it. Is it possible?
This query results in error:
SELECT md5(*) FROM bookings WHERE dep_id = 1;
Because md5 expects string as parameter - How can I send the whole result into md5 function?
[EDIT] I can't hardcode every single column name in the query because of - there is around 100 columns, besides their names/amount changes often.
Upvotes: 1
Views: 1883
Reputation: 15656
You need to concatenate all fields usding CONCAT
function:
SELECT md5(CONCAT(field1,field2,field3 ...)) FROM bookings WHERE dep_id = 1;
Upvotes: 2