Try using the IF function:
SELECT IF(`gu`.`StoppingUnitEventME`=`ese`.`MonitoringElement`, TRUE, FALSE)
FROM ...
or
SELECT IF(`gu`.`StoppingUnitEventME`=`ese`.`MonitoringElement`, 1, 0)
FROM ...
Even without the IF function, running
mysql> select ('rolando' = 'rolando') str_compare;
+-------------+
| str_compare |
+-------------+
| 1 |
+-------------+
1 row in set (0.00 sec)
mysql>
yield 0 or 1 using the mysql client
The problem is this: CAST() and CONVERT() can only accept and return the following types:
- BINARY[(N)]
- CHAR[(N)]
- DATE
- DATETIME
- DECIMAL[(M[,D])]
- SIGNED [INTEGER]
- TIME
- UNSIGNED [INTEGER]
Since BOOLEAN is not in this list, it can never be returned by CAST or CONVERT
You could use the IF function to generate strings
SELECT IF(`gu`.`StoppingUnitEventME`=`ese`.`MonitoringElement`, 'TRUE', 'FALSE')
FROM ...
From the MySQL Workbench 5.2 window, select Database -> Synchronize model which will allow you to synchronize the model (EER diagram) with the database (you need to create a saved connection) for it.
I recommend this method over just reverse engineering the model from the database since it maintains the layout of the EER diagram. One caveat is that you need to add new tables to the EER diagram manually.
Best Answer
BOOL
andBOOLEAN
are synonyms ofTINYINT
in MySQL. See MySQL docs: Numeric Type OverviewYou probably want to use the
BIT
datatype.