关于向sql语句添加另一列的问题

时间:2010-05-17 20:58:19

标签: sql

我从这张表开始:

alt text http://img696.imageshack.us/img696/8396/imagezx.png

SELECT [Lab Occurrence Form].[Practice Code], [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)], Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [CountOf1 0 Preanalytical (Before Testing)]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![By Number]![Text4] And [Forms]![By Number]![Text2]))
GROUP BY [Lab Occurrence Form].[Practice Code], [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]
HAVING ((([Lab Occurrence Form].[Practice Code])<>"") AND ((Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]))<>0));

它选择3列,但我需要聚合注释并将其放在第四列中,前两个值相同

1 个答案:

答案 0 :(得分:1)

使用MySQL,看一下GROUP_CONCAT()。