0

我的查询是:

 SELECT Batch.printedquantity, Batch.guid
 FROM Batch
 WHERE (((Batch.[guid]) In (Select Main.guid
 from Main
 where (Left(main.printertimestamp,10) = [date]))));

所以这返回如下:

    printedquantity     guid
     3                  {5FCE6B9A-88B0-41F7-A52B-21E0375B0433}
     10                 {C73EB60D-D707-4717-B505-667C445CC294}
     1                  {FEC25696-6AD6-4218-B7EB-2E5593054DAB}
     1                  {6CCDFB48-6B1B-4712-8C08-F06DA220455C}
     1                  {6CCDFB48-6B1B-4712-8C08-F06DA220455C}

我正在尝试获取printedquantity列的总数,但计数功能有问题。这可能吗?

4

1 回答 1

0

COUNT() 函数返回行数。要获得 printquantity 列的总数,听起来您确实在使用 SUM() 函数。完全未经测试,但以下可能会有所帮助......

SELECT SUM(Batch.printedquantity)
 FROM Batch
 WHERE (((Batch.[guid]) In (Select Main.guid
 from Main
 where (Left(main.printertimestamp,10) = [date]))));
于 2012-12-20T17:04:23.233 回答