Answer the question
In order to leave comments, you need to log in
How to merge two text columns into one?
There are two tables consisting of columns:
id, sDate, title
id,sDate,message
having the same data types:
Int, timestamp, text
If joined by id or sDate using the query
SELECT sDate as t FROM `tb1`
UNION ALL SELECT sDate as t FROM `tb2`
then
everything
works
fine
. UNION'"
Now the question is how to combine two text columns from different tables into one?
Answer the question
In order to leave comments, you need to log in
If you do not want (or do not have the opportunity) to change the collation of columns, include them in the query:
SELECT
cast(title as VARCHAR(200) CHARACTER SET utf8) COLLATE utf8_general_ci as t
FROM `tb1`
UNION ALL
SELECT cast(message as varchar(200) CHARACTER SET utf8) COLLATE utf8_general_ci as t
FROM `tb2`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question