Combining the results of two SQL queries as separate columns

前端 未结 4 1261
轮回少年
轮回少年 2020-11-27 16:32

I have two queries which return separate result sets, and the queries are returning the correct output.

How can I combine these two queries into one so that I can

4条回答
  •  情话喂你
    2020-11-27 17:08

    You can use a CROSS JOIN:

    SELECT *
    FROM (  SELECT SUM(Fdays) AS fDaysSum 
            FROM tblFieldDays 
            WHERE tblFieldDays.NameCode=35 
            AND tblFieldDays.WeekEnding=1) A -- use you real query here
    CROSS JOIN (SELECT SUM(CHdays) AS hrsSum 
                FROM tblChargeHours 
                WHERE tblChargeHours.NameCode=35 
                AND tblChargeHours.WeekEnding=1) B -- use you real query here
    

提交回复
热议问题