免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 650 | 回复: 0
打印 上一主题 下一主题

Everest 0.5 for 龙芯(beta1) 已经发布 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-05 10:49 |只看该作者 |倒序浏览
http://www.linux-ren.org/modules/newbb/viewtopic.php?post_id=35138&topic_id=6358
顺便附带一个笔记:
sql语句同结构多表联合查询,合并时如果选择字段太简单数据没有唯一确定行,会把相同记录合并的,如下示例多选几个字段能保证每行都不同就可得到正确结果
   
    for(int i=sday;i0)stab+=" union ";
                        stab+="SELECT subscriber.tel_num, talk_dur, charge,cli, dnis,call_time FROM "+getdate(year,month,i);
                        stab+=" LEFT OUTER JOIN subscriber ON subscriber.tel_num = ";
                        stab+=getdate(year,month,i)+".card WHERE (subscriber.account_num = '"+val+"')";
                        //stab+=" WHERE ("+getdate(year,month,i)+".card = '"+val+"')";
                    }
                }
                if(stab.length()>0){
                    sql="SELECT tel_num,COUNT(talk_dur) AS times,(COUNT(talk_dur)-SUM((talk_dur + 2)/(talk_dur + 1)-1))";
                    sql+=" AS talks, SUM(talk_dur) AS talkdur, SUM((talk_dur + 59) / 60) AS talklen, ";
                    sql+="SUM(charge) AS sumcharge FROM ("+stab+") DERIVEDTBL GROUP BY tel_num order by tel_num";
                }
-----
不同结构多表也可联合搜索某字段是否存在
sql="select company_worker_info.id,company_expert_info.id,company_monitor_info.id from ";
sql+="company_worker_info,company_expert_info ,company_monitor_info where (";
sql+="company_worker_info.workid='"+name+"' and company_worker_info.companyid='"+cid+"') or(";
sql+="company_expert_info.workid='"+name+"' and company_expert_info.companyid='"+cid+"') or(";
sql+="company_monitor_info.workid='"+name+"' and company_monitor_info.companyid='"+cid+"')";
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/11458/showart_673442.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP