Disputed Merchants

Description:Provides total count and dollar amount of disputes, by Merchant Name. 
Sources:Disputes

It is important that you always include tenantID in your WHERE clause.  Not doing so will result in poor performance.  

WHERE tenantid = 'YOURTENANTIDHERE'

SQL

SELECT
    d.merchant AS "Merchant",
    count(*) AS "Disputes",
    SUM(d.disputeamount) AS "Dispute Amount"
FROM
    disputes AS d
WHERE
    tenantid='YOURTENANTIDHERE'
    AND createdate=:daterange
GROUP BY
    "Merchant"
ORDER BY
    "Merchant" ASC