我在 mysql 中有一个视图“name_all”,它的结构是
colName varchar(30) utf8_general_ci
date varchar(76) utf8_general_ci
name varchar(43) latin1_swedish_ci
Run Code Online (Sandbox Code Playgroud)
当我尝试运行查询时:
SELECT CONCAT(`colname`,' of Mr. ',`name`,' Expire on ',`date`) FROM name_all
Run Code Online (Sandbox Code Playgroud)
它给出错误:
#1271 - Illegal mix of collations for operation 'concat'
"colName" is basically a Column Name which is used as a row in this View
"date" is mysql Date which is converted in this format '%a %D %b, %Y'
"name" is concatenation of firstname, middlename, lastname from a table
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题,我的错误是什么?
当我运行查询 SHOW VARIABLES LIKE 'collation%' 结果是
Variable_name …Run Code Online (Sandbox Code Playgroud) 我有一个视图,是从多个表视图结构创建的
id col1 col2 col3 col4
101 A B B NULL
102 C F A G
Run Code Online (Sandbox Code Playgroud)
等等(这是样本)
我想创建另一个看起来像的视图
ID col_name value
101 col1 A
101 col2 B
101 col3 B
101 col4 NULL
102 col1 C
102 col2 F
102 col3 A
102 col4 G
Run Code Online (Sandbox Code Playgroud)
等等
任何人都可以帮助plzzz