We will create a new report from scratch. In order to do this, we will need to create the report itself, then create a JDBC-type data set and establish its SQL query. Finally, we will create a general layout, which means we will need to add to our report a series of objects and configure them properly.
07_Adding_Parameters.prpt
.SELECT film.rating, film.title, SUM(payment.amount) AS sum_amount, COUNT(1) AS count_rental FROM payment INNER JOIN rental ON rental.rental_id=payment.rental_id INNER JOIN inventory ON inventory.inventory_id=rental.inventory_id INNER JOIN film ON film.film_id=inventory.film_id WHERE film.rating IN ('G','PG','PG-13','R','NC-17') AND YEAR(payment.payment_date) = 2005 AND MONTH(payment_date) = 6 GROUP BY film.film_id ORDER BY film.rating, film.title
Initially, we will use the default values for film.rating
, YEAR(payment.payment_date)
, and MONTH(payment_date)
. Later on, we will allow these values to be modified dynamically by the final user.
sum_amount
field using the following:$ #,##0.00;($ #,##0.00)