0
                  EthylAcetate      PrintCylinder   HDpolythene
                       12                8               5
                        9                2               9

我想分别添加每列中的值,并datagrid根据总数按降序对列进行排序。上面我提到了我使用的代码。

它确实给了我每一行的总数,但它没有给我排序的列。

cmd.CommandText = "SELECT sum(eAce) as SumEacetate , sum(pCl) as PrintCylinder  , sum(hdp) as HDpolythene FROM TblSalesOrder ORDER BY SumEacetate, PrintCylinder  , HDpolythene DESC ;"
4

1 回答 1

0

DESC您必须在每列中写入关键字

cmd.CommandText = "SELECT sum(eAce) as SumEacetate , sum(pCl) as PrintCylinder  , sum(hdp) as HDpolythene FROM TblSalesOrder ORDER BY SumEacetate DESC, PrintCylinder DESC, HDpolythene DESC ;"
于 2013-07-07T18:55:42.043 回答