,Officers as b where a.OfficerID = b.Officer and a.QueryID = @QueryID and a.GroupID = 0 union
      select b.Officer,b.Name,a.OrderNo,
        ISNULL((select 1 from HBQuerySignStory as n where a.SignID = n.Id and b.Officer = n.OfficerID),0),
        c.GroupName,d.GroupID from
        HBQuerySignNew as a,Officers as b,Groups as c,GroupsMembers as d where
        a.GroupID = d.GroupID and(d.GroupID = c.GroupID and d.Officer = b.Officer) and
        a.QueryID = @QueryID and a.OfficerID = d.Officer order by 3 asc,5 asc
    end
  else
    --///////////////////////////////////////////////////////////////////////////////////////
    -- 3 -     