(@CustomerID int)SELECT [ID],[CustomerID], [WareHouseName], [WareHouseType] FROM RB_WareHouse (NOLOCK) WHERE CustomerID = @CustomerID and WareHouseType!=81 and ID in (5312) union all select a.ID,a.CustomerID,a.[WareHouseName],b.WareHouseType from RB_WareHouse a with (nolock) inner join RB_WareHouse b with (nolock) on a.AutonomousWareHouseID=b.ID and a.CustomerID=b.CustomerID where a.CustomerID=@CustomerID and a.WareHouseType=81 and a.ID in (5312)