Time for action – modifying the SQL query
We will now modify the previously defined SQL query with the objective of getting a data set that is more suitable to working with groups.
Go to the Data panel (in the Panel tab). Within the Data Sets tree, we will right-click on the JDBC: sakila db node and select the Edit Datasource... option, as shown in the following screenshot:
Just as in the previous chapter, we will be presented with the Connections Editor window. What we will do here is select the sakila db item within the Connection section; then, in the Available Queries section, we will select CountryCustomerAmount.
Now, in the Query section, we will select the SQL query written there and delete it and then replace it with the following code:
SELECT country.country_id, country.country, customer.first_name, customer.last_name, SUM(payment.amount) sum_amount FROM payment INNER JOIN customer ON customer.customer_id=payment.customer_id INNER JOIN address ON address.address_id=customer.address_id...