答案 0 :(得分:0)
<强> 1。使用SQL查询
执行此操作declare @tb as TABLE ([number] int NULL, [fruit] [varchar](50) NULL)
INSERT into @tb ([number], [fruit]) VALUES (3, N'apple')
INSERT into @tb ([number], [fruit]) VALUES (4, N'apple')
INSERT into @tb ([number], [fruit]) VALUES (6, N'banana')
INSERT into @tb ([number], [fruit]) VALUES (5, N'orange')
INSERT into @tb ([number], [fruit]) VALUES (7, N'orange')
INSERT into @tb ([number], [fruit]) VALUES (8, N'apple')
INSERT into @tb ([number], [fruit]) VALUES (9, N'banana')
select fruit,count(number) as count from @tb group by fruit
-------------------被修改-------------------