select (CHARACTER_LENGTH(group_concat(dest_mobile separator ';'))+1)/12 phone_count ,u.username , 
DATE_FORMAT(m.date_time2, '%Y-%m-%d') date_time2,a.c_name from         
(select * from mt_sms union all select * from mt_sms_200801) m ,           #《==这里
users u , boss_customer c ,boss_agent a 
where u.user_id=m.user_id  and   c.user_id=u.user_id and c.agent_id=a.id 
and  substring(m.date_time2,1,10) >='2008-06-01' and  
substring(m.date_time2,1,10) <='2008-06-05' 
group by u.username,DATE_FORMAT(m.date_time2, '%Y-%m-%d') limit 0,20报错:ERROR 126 Incorrect key file for table '#sql_bcb_7.MYI';try to repair it如果我把第三行改为:
(select * from mt_sms) m ,
 运行正常,但如果不改就有可能出错,偶尔也不出错。

解决方案 »

  1.   

    实际的情况是由于数据量比较大,系统每月的数据会单独放到一张表里,但用户有查询历史数据的需求,需要union历史表给他们查,不知道有不有其他更成熟更可行的解决办法??请指教。
    ps.这个帖子我会按时结帖,希望大家帮忙,不用担心分数和结帖的问题,分数不够可以加!
      

  2.   

    1、有可能是版本不同(升级的情况下);
    2、
     这是一个BUG吧,
    Your server is running out of diskspace where MySQL stores temporary tables,
    增加MYSQL临时表的SIZE
    3、表损坏
    CHECK TABLE statement语句来检查MyISAM表的健康,并用REPAIR TABLE修复一个损坏的MyISAM表。
      

  3.   

    应该是2
    [root@localhost mysql]# df -k
    Îļþϵͳ               1K-¿é        已用     可用   已用% ¹ÒÔصã
    /dev/sdb1            141383156 131693604   2507696  99% /
    /dev/sda1               101089     15115     80755  16% /boot
    none                   1027436         0   1027436   0% /dev/shm
    1和3没问题。
    请问是临时表空间不够,还是硬盘空间不够了??
      

  4.   

    清理MYSQL所在的磁盘,扩大临时表的空间试试