日期:2014-05-19  浏览次数:20522 次

高手赶紧来帮忙啊 谢谢大家了 解决马上结贴
select   HrbWeb_newsRecord.*   ,HrbWeb_File.*
  from   HrbWeb_newsRecord,HrbWeb_File
where   HrbWeb_File.File_zhannei_id  
like   '%% '   and  
HrbWeb_File.File_new_date
  like   '%% '   and  
HrbWeb_newsRecord.new_Title  
like   '%赵宏阳% '   and   HrbWeb_newsRecord.new_lanmuid=31
  and   HrbWeb_newsRecord.new_deleteOk=0   and   HrbWeb_newsRecord.new_passed=1  
and   HrbWeb_newsRecord.new_Id=HrbWeb_File.File_new_Id  
order   by   HrbWeb_newsRecord.new_top   desc,HrbWeb_newsRecord.new_date   desc   ,HrbWeb_newsRecord.new_id   desc
这句话   怎么执行完了   出现在   20多条   重复数据   谢谢   应该怎么处理


------解决方案--------------------
select distinct HrbWeb_newsRecord.* ,HrbWeb_File.*
from HrbWeb_newsRecord,HrbWeb_File
where HrbWeb_File.File_zhannei_id
like '%% ' and
HrbWeb_File.File_new_date
like '%% ' and
HrbWeb_newsRecord.new_Title
like '%赵宏阳% ' and HrbWeb_newsRecord.new_lanmuid=31
and HrbWeb_newsRecord.new_deleteOk=0 and HrbWeb_newsRecord.new_passed=1
and HrbWeb_newsRecord.new_Id=HrbWeb_File.File_new_Id
order by HrbWeb_newsRecord.new_top desc

---这样吗?
------解决方案--------------------
--试试,加distinct ?
select distinct HrbWeb_newsRecord.* ,HrbWeb_File.*
from HrbWeb_newsRecord,HrbWeb_File
where HrbWeb_File.File_zhannei_id
like '%% ' and
HrbWeb_File.File_new_date
like '%% ' and
HrbWeb_newsRecord.new_Title
like '%赵宏阳% ' and HrbWeb_newsRecord.new_lanmuid=31
and HrbWeb_newsRecord.new_deleteOk=0 and HrbWeb_newsRecord.new_passed=1
and HrbWeb_newsRecord.new_Id=HrbWeb_File.File_new_Id
order by HrbWeb_newsRecord.new_top desc,HrbWeb_newsRecord.new_date desc ,HrbWeb_newsRecord.new_id desc

------解决方案--------------------
try

select
Distinct
HrbWeb_newsRecord.* ,HrbWeb_File.*
from HrbWeb_newsRecord,HrbWeb_File
where HrbWeb_File.File_zhannei_id
like '%% ' and
HrbWeb_File.File_new_date
like '%% ' and
HrbWeb_newsRecord.new_Title
like '%赵宏阳% ' and HrbWeb_newsRecord.new_lanmuid=31
and HrbWeb_newsRecord.new_deleteOk=0 and HrbWeb_newsRecord.new_passed=1
and HrbWeb_newsRecord.new_Id=HrbWeb_File.File_new_Id
order by HrbWeb_newsRecord.new_top desc,HrbWeb_newsRecord.new_date desc ,HrbWeb_newsRecord.new_id desc

------解决方案--------------------
整理下

select
Distinct
A.* ,B.*
from HrbWeb_newsRecord A,HrbWeb_File B
where
B.File_zhannei_id like '%% '
and B.File_new_date like '%% '
and A.new_Title like '%赵宏阳% '
and A.new_lanmuid=31
and A.new_deleteOk=0
and A.new_passed=1
and A.new_Id=B.File_new_Id
order by
A.new_top desc,A.new_date desc ,A.new_id desc