日期:2014-05-18  浏览次数:20367 次

关于以下的数据我想用一条语句查询出所有数据,哪位大虾可以帮帮我啊.在线等!急急!

ID             FID                     Lname
2 0 配电房进线(树杆)
21 2 配电房进线(树杆)
211 21 配电房进线(树杆)
212 21 配电房进线(树杆)
213 21 配电房进线(树杆)
214 21 配电房进线(树杆)
216 21 配电房进线(树杆)
22 2 配配电房进线(树杆)

目前我用以下这个语句只能查出FID为2的ID为21的相关记录,我想把FID为2,ID为22的数据也显示出来.

select   lineid,linefid,lname   from   sys_Line   where   lineid=2   or   linefid=2  
or   linefid=(select   top   1   lineid   from   sys_line   where   linefid=2   and   lineid <> 0)


在线等!急急!

------解决方案--------------------
select lineid,linefid,lname from sys_Line where linefid=2 and lineid in (21,22)