开发者

My SQL Subquery - Blob returned, need text value

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.


Found it myself.

(CONVERT(roomtype USING latin1))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜