有大神帮忙看下吗?本月合计,本年合计问题

Kaelz Kaelz 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
类似财务账本的显示
CREATE TABLE [dbo].[stockin](
[fdate] [datetime] NULL,
[fitemname] [varchar](100) NULL,
[fqtyin] [decimal](18, 2) NULL,
[fqtyou] [decimal](18, 2) NULL,
[fmonth] [datetime] NULL,
[fday] [datetime] NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[stockin] ([fdate], [fitemname], [fqtyin], [fqtyou], [fmonth], [fday]) VALUES (CAST(0x000092F600000000 AS DateTime), N'AAA', CAST(125.00 AS Decimal(18, 2)), CAST(20.00 AS Decimal(18, 2)), CAST(0x00009312018B80D4 AS DateTime), CAST(0x00009312018B7FA8 AS DateTime))
INSERT [dbo].[stockin] ([fdate], [fitemname], [fqtyin], [fqtyou], [fmonth], [fday]) VALUES (CAST(0x000092FD00000000 AS DateTime), N'AAA', CAST(120.00 AS Decimal(18, 2)), CAST(20.00 AS Decimal(18, 2)), CAST(0x00009312018B80D4 AS DateTime), CAST(0x00009312018B7FA8 AS DateTime))
INSERT [dbo].[stockin] ([fdate], [fitemname], [fqtyin], [fqtyou], [fmonth], [fday]) VALUES (CAST(0x0000930000000000 AS DateTime), N'BBB', CAST(-20.00 AS Decimal(18, 2)), CAST(20.00 AS Decimal(18, 2)), CAST(0x00009312018B80D4 AS DateTime), CAST(0x00009312018B7FA8 AS DateTime))
INSERT [dbo].[stockin] ([fdate], [fitemname], [fqtyin], [fqtyou], [fmonth], [fday]) VALUES (CAST(0x0000931100000000 AS DateTime), N'AAA', CAST(25.00 AS Decimal(18, 2)), CAST(20.00 AS Decimal(18, 2)), CAST(0x00009312018B80D4 AS DateTime), CAST(0x00009312018B7FA8 AS DateTime))
INSERT [dbo].[stockin] ([fdate], [fitemname], [fqtyin], [fqtyou], [fmonth], [fday]) VALUES (CAST(0x0000931500000000 AS DateTime), N'BBB', CAST(100.00 AS Decimal(18, 2)), CAST(20.00 AS Decimal(18, 2)), CAST(0x0000932E018B80D4 AS DateTime), CAST(0x0000932E018B7FA8 AS DateTime))
INSERT [dbo].[stockin] ([fdate], [fitemname], [fqtyin], [fqtyou], [fmonth], [fday]) VALUES (CAST(0x0000933300000000 AS DateTime), N'CCC', CAST(120.00 AS Decimal(18, 2)), CAST(20.00 AS Decimal(18, 2)), CAST(0x0000934D018B80D4 AS DateTime), CAST(0x0000934D018B7FA8 AS DateTime))

求每月的本月合计,每个月下面追加本年合计

该如何用SQL实现呢??大神求帮忙!!!万分感谢!
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
Kaelz
疑难问题 22,298 成员 121,727 内容