日期:2014-05-18 浏览次数:20361 次
id int title varchar
id int parentid int --主表的ID filename varchar
select top 25 a.* from ta a join tb b on a.id=b.parentid where b.filename is not null or filename<>''
------解决方案--------------------
select top 25 a.* from tb a,tb b where a.id=b.id and b.filename is not null
------解决方案--------------------
SELECT TOP 25 a.* FROM ta a,tb b WHERE a.id=b.parentid AND( b.filename is not null AND b.filename<>'')
------解决方案--------------------
select top 25 p.id,p.title,s.filename from temp_main as p inner join temp_detail as s on p.id=s.parentid where filename is not null or filename<>''