HQL查询求助 from table1 as a,table1 as b where a.tCode = b.sCode and (a.tCode ='1000' or a.tCode='1002') 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 2楼你怎么不直接select * from table1 where id='1' or id ='2' 呵呵,这个查询条件有点麻烦哦,而且你还要符合条件的值在其中一个表的一个字段中有两个(汗...),分两步吧,1.先想办法把sCode中有重复值的元组找到吧2.在根据得到的值在tCode中找,看能否找到,如果找到,则你要的结果出来了也可以把1.2颠倒,先在两表中找相等的,再把得到的值在sCode中找下有没有重复,OK=====蜗牛小屋http://www.pjwqh.cn==== 问题解决了欢迎到http://www.pjwqh.cn/message/index.jsp告诉我你的解决办法^_^ 去看看你自己的这个帖子,我给你回复过了http://topic.csdn.net/u/20080806/16/621b7bb3-12a7-4d4f-9f40-751d433f62d5.html还是分享下吧:select count(*),tCode,sCode from table1 group by tCode,sCode having count(*) > 1 select * from table1 a where a.tCode in(select sCode from tab1) ......sCode要有重复且tCOde=sCodeselect t.* from table1 t,(select sCode,count(*) total from table1 group by sCode)temp where t.tCode = t.sCode and t.sCode = temp.sCode and temp.total >= 2 关于“FCKeditorAPI”未定义的解决方法,供碰到相同问题的TX参考 xwork 验证框架的问题 ajaxfileupload json 无法解析 为什么form表单里的中文是乱码 jsp 链接mysql数据库的测试程序,有点问题。麻烦高手指点一下了。 求购一个文件上传实例!! struts标签生成的表单 参数保存问题 50分求Fckeditor在linux+Jsp环境下图片上传问题 js中的JSON数据为什么取不出来 请问highcharts能做出下图的图标吗 javascript函数怎么传中文参数 关于一个类,总编译错误,希望大侠指点
分两步吧,
1.先想办法把sCode中有重复值的元组找到吧
2.在根据得到的值在tCode中找,看能否找到,如果找到,则你要的结果出来了
也可以把1.2颠倒,
先在两表中找相等的,再把得到的值在sCode中找下有没有重复,
OK
=====蜗牛小屋http://www.pjwqh.cn====
sCode要有重复且tCOde=sCodeselect t.* from table1 t,(select sCode,count(*) total from table1 group by sCode)temp where t.tCode = t.sCode and t.sCode = temp.sCode and temp.total >= 2