Title: Custom Query SELECT SUM()
Last modified: December 23, 2017

---

# Custom Query SELECT SUM()

 *  Resolved [mads](https://wordpress.org/support/users/madstudio/)
 * (@madstudio)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/custom-query-select-sum/)
 * Hello,
 * I have a Currency DS field. In the “Custom Query section” i insert:
    “SELECT 
   column-name FROM table-name” > the “test query” work if i insert “SELECT SUM(
   column-name) FROM table-name” > the “test query” doesn´t work i need “SELECT 
   SUM(column-name) FROM table-name WHERE condition” > How can i fix the problem?
 * Can you help me, please?
 * Best Regards.
    mads
 * Version 10.0.301

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/custom-query-select-sum/#post-9808800)
 * Hello [@madstudio](https://wordpress.org/support/users/madstudio/),
 * You always need to use the aliases in the “SELECT” clause or the plugin cannot
   identify the column that is used for the field’s value.
 * SELECT SUM(column-name) as value FROM table-name WHERE condition
 * Pay attention the “as value” in the query.
 * In fields like DropDown DS fields (Checkbox DS, Radio Button DS), you should 
   select at least two columns for values and texts (pay attention the hypothetical
   query below):
 * SELECT column_name as value, column2_name as text FROM table_name WHERE condition
 * Please, take into account that you sent me only hypothetical queries, I cannot
   ensure that the queries you are using are correct or not.
 * Best regards.
 *  Thread Starter [mads](https://wordpress.org/support/users/madstudio/)
 * (@madstudio)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/custom-query-select-sum/#post-9809262)
 * Hei,
 * it works. thank you.
    Thank you for the great support & the great plugin.
 * best regards.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Query SELECT SUM()’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [mads](https://wordpress.org/support/users/madstudio/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/custom-query-select-sum/#post-9809262)
 * Status: resolved