代码之家  ›  专栏  ›  技术社区  ›  bluethundr

在python中从mysql将total of column写入单个列

  •  0
  • bluethundr  · 技术社区  · 5 年前

    我将MySQL中的一个列的总和相加:

    add_column_sql = """ SELECT ROUND(SUM(UnBlendedCost), 2) FROM """ + table_name + """ WHERE UnBlendedCost IS NOT NULL; """
    

    我在CSV中有这些列:

    fieldnames = ['Account Number', 'Product Name', 'Item Description', 'Resource ID', 'UnBlended Cost', 'UnBlended Rate', 'Name', 'Owner', 'Engagement']
    

    我想追加到文件的末尾,并让总数显示在“unblendcost”列下。

    我怎样才能做到这一点?

    0 回复  |  直到 5 年前