各位大虾:
小弟最近将社区版的库通过sqldump备成脚本,然后再到企业版中导入。查询结果乱码不说(数据库字符集两库一致),里面创建的视图居然不能用,把视图里面的查询语句拷贝单独执行又能查询出结果,将查询语句另起一个新视图名创建后查询又能出结果。我就糊涂了。
求各位指点方向。
就这视图,用视图名称查结果为空,用下面的语句查结果正常。将下面的查询语句起一新视图名创建,又能查出结果。
create view v_jh_ringing_ycIndex
as
select '下载同歌三次以上' as 'ycIndexName',left(lie6*100,INSTR(lie6*100,'.')+2) as 'ycValue' from jh_ringing where city = convert('全省' using gbk)
union
select '下载无流量' as 'ycIndexName',left(lie10*100,INSTR(lie10*100,'.')+2) as 'ycValue' from jh_ringing where city = convert('全省' using gbk)
union
select '无效用户' as 'ycIndexName',left(lie14*100,INSTR(lie14*100,'.')+2) as 'ycValue' from jh_ringing where city = convert('全省' using gbk)
union
select '下载同CP歌曲+振铃15次以上' as 'ycIndexName',left(lie18*100,INSTR(lie18*100,'.')+2) as 'ycValue' from jh_ringing where city = convert('全省' using gbk);
这个视图使用上面的视图
................
UNION
select
'振铃' as 'busName',
lie22 as 'bili',
(select CONCAT(ycindexName,concat('--',ycValue,'%')) from v_jh_ringing_ycIndex order by ycValue desc limit 1) as 'ycIndex',
(select GROUP_CONCAT(city) as 'city' from v_jh_ringing_city where qujian = 1 group by qujian) as 'Exceed10',
(select GROUP_CONCAT(city) as 'city' from v_jh_ringing_city where qujian = 2 group by qujian) as 'Between10and8',
(select GROUP_CONCAT(city) as 'city' from v_jh_ringing_city where qujian = 3 group by qujian) as 'NotExcessive'
from
jh_ringing
where
city=convert('全省' using gbk);
字符集情况
character_set_client gbk
_connection gbk
_database gbk
_filesystem binary
_results gbk
_server utf8
_system utf8
|