I've written a simple aggregation view over a table, and the view returns different data types that the table. This causes some issues on the application side.
Here's a simplified query for the sake of the example:
SELECT id, FLOOR(date_id / 100) month_id, SUM(value) FROM some_table WHERE....;
The problem is that data_id is an INTEGER(11) column, represented in my app as an int32, and the result of
FLOOR(date_id / 100) is a BIGINT, represented in my app as an int64.
The type of id also changes, for reasons I can't explain, from int64 to int32.
Is there any way to cast the column to an int32? CAST seemed not to work. I haven't found any documentation for a way to see what the expected data type of a view result set is.