COQL Query, trying to add GROUP BY and SUM
hello
I play with coql, works good
this my code and the return json (excerpt)
- queryMap = Map();
- queryMap.put("select_query","select el_quote_date, Grand_Total, Contact_Name, Created_By from Quotes where Created_Time between '" + before + "' and '" + cur + "'");
- response = invokeurl
- [
- url :"https://www.zohoapis.eu/crm/v3/coql"
- type :POST
- parameters:queryMap.toString()
- connection:"el_make_api_call_zoho_crm_coql"
- ];
- allquotes = response.get("data");
- info allquotes;
- {
- "Grand_Total": 5100.78,
- "el_quote_date": "2023-11-29",
- "id": "435213000022924021",
- "Created_By": {
- "id": "435213000012625001"
- },
- "Contact_Name": {
- "id": "435213000022924013"
- }
- }, etc....
I'm trying to explain what I need
I 'd like to have SUM & Group by :
1- sum (Grand_Total) of quotes that belongs to Created_By (id of the user), count quotes
I think to get the user name need to have a JOIN because in the result we have only the user id (see above)
the results will be something like these :
- {
- "SUM Grand_Total": 15000,
- "Count": 17,
- "Created_By": "Mr XXXX"
- },
- {
- "SUM Grand_Total": 1000,
- "Count": 5,
- "Created_By": "Mr YYYY"
- } etc....
Hope I'm clear,
Thanks for the insights