select a.fname ,c.fname as fgroupname from t_user a inner join t_group b on a.FUserID =b.FUserID inner join #temp c on c.fuserid =b.FGroupID where a.FForbidden =0 order by a.fname select * from t_user select *into #temp from t_User where fuserid <100