select A.積月,B.受注本数
from
(select '2004' as
union all select '2003'
union all select '2002'
union all select '2001') A left join 注文仮置明細 B
where A.積月=B.積月
order by 積月
from
(select '2004' as
union all select '2003'
union all select '2002'
union all select '2001') A left join 注文仮置明細 B
where A.積月=B.積月
order by 積月
from
(select '2004' as 積月
union all select '2003'
union all select '2002'
union all select '2001') A left join 注文仮置明細 B
where A.積月=B.積月
order by 積月
select a.積月 ,b.受注本数 from #year a,注文仮置明細 b order by a.積月
select a.積月 ,b.受注本数 from #year a,注文仮置明細 b
where a.積月 = b.積月 order by a.積月
from
(select '2004' as 積月
union all select '2003' as 積月
union all select '2002' as 積月
union all select '2001' as 積月) A left join 注文仮置明細 B
where A.積月=B.積月
order by A.積月