tags:

views:

42

answers:

1

Hi, I'm trying to write a case statement in mysql which checks if a person has booked a room. If they have, then return the roomtype, 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 query. If I run it like this, BLOB is returned for every row in the accommodation column. If I change the word 'roomtype' to a column which returns an integer, it works fine.

Is there a way to convert the BLOB to string within mysql?

Any advice appreciated.

Thanks.

+1  A: 

Found it myself.

(CONVERT(roomtype USING latin1))
Dan