Hi:
I am writing a query using MySQL and am running into some problems. Hopefully someone can help. My first query gets the year and month from the database and then concats them to create a datetime. When I run that query by itself, it displays the correct datetime format. However, when I union that query to another query which has real datetimes and then run the query, it does not show me a datetime anymore, rather it comes up as a blob. What am I doing wrong?
PS: The Month is retrieved from a column in the database which is INT unsigned. The Year is retrieved from a column in the database which is varchar(255).
Thanks in advance.
I am writing a query using MySQL and am running into some problems. Hopefully someone can help. My first query gets the year and month from the database and then concats them to create a datetime. When I run that query by itself, it displays the correct datetime format. However, when I union that query to another query which has real datetimes and then run the query, it does not show me a datetime anymore, rather it comes up as a blob. What am I doing wrong?
Code:
SELECT
tb1.portal_id,
CONCAT(tb12.TheYear,IF (tb11.TheMonth<10,'-0','-'),tb11.TheMonth,'-01 00:00:00') AS KeyDateTime
...
FROM
portals AS tb1
...
UNION ALL
SELECT
tb1.portal_id,
tb2.StartDateTime,
...
FROM
portals AS tb1
...
PS: The Month is retrieved from a column in the database which is INT unsigned. The Year is retrieved from a column in the database which is varchar(255).
Thanks in advance.