score:0

as subqueries

 select 
     (SELECT ISNULL(SUM(Stocking_Count),0)
    FROM Fish_Stocking
    where fish_id = 'B2017-1' and tank_id = 'H A01' and
          Date_Assigned = '2017-02-02' and stocking_date <= '2017-03-28') [Field1],

    ( SELECT ISNULL(SUM(NO_FISH_SWUM_OFF),0)
    FROM Swim_Thru
    where Dest_fish_id = 'B2017-1' and Dest_tank_id = 'H A01' and
          Dest_Date_Assigned = '2017-02-02' and date_swim_thru <= '2017-03-28') [Field2]

score:0

I hope this is what you are trying which can be accomplished with UNION ALL as below.

NOTE: I have also changed ISNULL(SUM(Stocking_Count),0) to SUM(ISNULL(Stocking_Count, 0)).

SELECT SUM(Total) AS Total FROM (
    (SELECT SUM(ISNULL(Stocking_Count, 0)) as Total
    FROM Fish_Stocking
    where fish_id = 'B2017-1' and tank_id = 'H A01' and
          Date_Assigned = '2017-02-02' and stocking_date <= '2017-03-28')

    UNION ALL

    (SELECT SUM(ISNULL(NO_FISH_SWUM_OFF, 0)) as Total
    FROM Swim_Thru
    where Dest_fish_id = 'B2017-1' and Dest_tank_id = 'H A01' and
          Dest_Date_Assigned = '2017-02-02' and date_swim_thru <= '2017-03-28')

) Net

More questions

More questions with similar tag