头疼了。找不出问题。呼叫支援。这样就没问题
insert into web (loginname,showname,groupname,visit,webtype,url)
values ('一','二','三','四','五','六')这样就报错,1366 - incorrect string value
insert into web (loginname,showname,groupname,visit,webtype,url)
select * from 
(
select b.name as bname, b.show_name,c.group_name,d.name as dname,e.name as ename,
left(substring(substring(f.result,locate('<_f n="url">',f.result)),locate('>',substring(f.result,locate('<_f n="url">',f.result)))+1),
locate('<',substring(substring(f.result,locate('<_f n="url">',f.result)),locate('>',substring(f.result,locate('<_f n="url">',f.result)))+1))-1
) as '网址'
 from 
(
select * from (select A.auto_id, A.record_id, A.account_id, A.dev_id, A.user_crc, A.group_crc, host_ip, dst_ip, private_type, serv_crc, app_crc, record_time, net_action, index3, index4
from A20110315 A use index(index_auto_id), AcGroupInfo
where  private_type in (1, 16) and group_crc_2 =
(select group_crc from groupname where group_name like '%南方销售公司%' limit 1)
and user_crc =
(select crc from username where show_name like '%陈远二%' limit 1)  
 and group_crc_1 = 2043925204 and AcGroupInfo.group_crc = A.group_crc and serv_crc = 3281598801 and (A.index3 = 0 or A.index3 = 1) and (A.net_action = 2 or A.net_action = 3)
order by auto_id
) _TMP_TABLE_ order by _TMP_TABLE_.auto_id desc
) a 
join UserName b on  a.user_crc = b.crc
join GroupName c on a.group_crc = c.group_crc
join crc_name d on a.serv_crc = d.crc
join crc_name e on a.app_crc = e.crc
join U20110315 f on a.record_id = f.record_id and a.account_id= f.account_id and a.dev_id=f.dev_id 
) as tb

解决方案 »

  1.   

    能给个方向么,大概是什么问题,从来没用过MYSQL。 我在网上看来看去都是设置字符集的,但是我第一个语句测试了可以插入中文
      

  2.   

    select * from 
    (
    select b.name as bname, b.show_name,c.group_name,d.name as dname,e.name as ename,
        left(substring(substring(f.result,locate('<_f n="url">',f.result)),locate('>',substring(f.result,locate('<_f n="url">',f.result)))+1),
            locate('<',substring(substring(f.result,locate('<_f n="url">',f.result)),locate('>',substring(f.result,locate('<_f n="url">',f.result)))+1))-1
        ) as '网址'
     from 
    (
    select * from (select A.auto_id, A.record_id, A.account_id, A.dev_id, A.user_crc, A.group_crc, host_ip, dst_ip, private_type, serv_crc, app_crc, record_time, net_action, index3, index4
    from A20110315 A use index(index_auto_id), AcGroupInfo
    where  private_type in (1, 16) and group_crc_2 =
    (select group_crc from groupname where group_name like '%南方销售公司%' limit 1)
    and user_crc =
    (select crc from username where show_name like '%陈远二%' limit 1)  
     and group_crc_1 = 2043925204 and AcGroupInfo.group_crc = A.group_crc and serv_crc = 3281598801 and (A.index3 = 0 or A.index3 = 1) and (A.net_action = 2 or A.net_action = 3)
    order by auto_id
    ) _TMP_TABLE_ order by _TMP_TABLE_.auto_id desc
    ) a 
    join UserName b on  a.user_crc = b.crc
    join GroupName c on a.group_crc = c.group_crc
    join crc_name d on a.serv_crc = d.crc
    join crc_name e on a.app_crc = e.crc
    join U20110315 f on a.record_id = f.record_id and a.account_id= f.account_id and a.dev_id=f.dev_id 
    ) as tb
    查询出的结果集是什么?
      

  3.   

    这样就报错,1366 - incorrect string value
    把下面那个查询结果查出来,看下.
    应该是列有格式不对的,比如长度,字段类型.
      

  4.   

    大概是这个样子的 URL太长我不好粘贴
    chenye 陈远二 /南方销售公司/ 访问网站 新闻门户
    chenye 陈远二 /南方销售公司/ 访问网站 IT相关
    chenye 陈远二 /南方销售公司/ 访问网站 论坛博客
    chenye 陈远二 /南方销售公司/ 访问网站 新闻门户
    chenye 陈远二 /南方销售公司/ 访问网站 新闻门户
    chenye 陈远二 /南方销售公司/ 访问网站 permit_url
    chenye 陈远二 /南方销售公司/ 访问网站 新闻门户
    chenye 陈远二 /南方销售公司/ 访问网站 新闻门户
    chenye 陈远二 /南方销售公司/ 访问网站 搜索引擎
    chenye 陈远二 /南方销售公司/ 访问网站 搜索引擎
    chenye 陈远二 /南方销售公司/ 访问网站 IT相关
    chenye 陈远二 /南方销售公司/ 访问网站 IT相关
    chenye 陈远二 /南方销售公司/ 访问网站 生活相关
    chenye 陈远二 /南方销售公司/ 访问网站 生活相关
    chenye 陈远二 /南方销售公司/ 访问网站 IT相关
    chenye 陈远二 /南方销售公司/ 访问网站 IT相关