My SQL subquery - Blob is back, need a text value

I am trying to write a case statement in mysql that checks if a person has booked a room. If they are, return the type of number, otherwise return an informative message.

( CASE WHEN (eab.accommodation_id > 0) THEN (SELECT roomtype FROM event_accomodation WHERE id = eab.accommodation_id) ELSE (IFNULL(eab.accommodation_id, 'No accommodation needed')) END ) AS accommodation 

This is the relevant part of the request. If I run it like this, a BLOB is returned for each row in the allocation column. If I change the word "roomtype" to a column that returns an integer, it works fine.

Is there a way to convert BLOB to string in mysql?

Any advice is appreciated.

Thanks.

+4
source share
1 answer

Found it myself.

 (CONVERT(roomtype USING latin1)) 
+4
source

Source: https://habr.com/ru/post/1299532/


All Articles