【发布时间】:2018-08-04 07:22:19
【问题描述】:
第一个查询:
select
pid, month(dates) as month, sum(quan) as quan
from
purchase
where
month(dates) between 1 and 12
and pid = 4
group by
pid, month(dates)
第二次查询:
select
pid, month(dates) as months, sum(quan) as TotalAmount
from
inward
where
month(dates) between 1 and 12
and pid = 4
group by
pid, month(dates)
第三次查询:
select
pid, month(dates) as months, sum(quan) as TotalAmount
from
issue
where
month(dates) between 1 and 12
and pid = 4
group by
pid, month(dates)
我不知道如何加入这些查询以输出 pid 是外键
【问题讨论】:
-
您使用的是哪个 DBMS?甲骨文? MySQL? SQL 服务器? ...
-
SQL 服务器正在使用中
标签: sql sql-server-2008 join