鏈接表自已
begin if @Type='All'
select a.*, b. MenuName as PMenuName from SysMenu a left join SysMenu b on a.PMenuID=b.MenuID where a.Status='Y' order by cast(a.MenuID as int)
else if @Type='Single'
select a.*, b. MenuName as PMenuName from SysMenu a left join SysMenu b on a.PMenuID=b.MenuID where a.MenuID=@FieldValue
else
select a.*, b. MenuName as PMenuName from SysMenu a left join SysMenu b on a.PMenuID=b.MenuID where a.Status='Y' order by cast(a.MenuID as int)
end
加粗部份為何需要這樣來鏈接自已呢??在什麼情況下需要這樣鏈接查詢呢?