Hi,
In my famous Books and Authors example (each author writes multiple books, each book has one author), the Books table contains a column with the price of the book. Now I want to show a table with for each author the sum of the prices of all books for that author. So I have the following tables:
Book: id, author_id, title, priceAnd I want the following query:
FROM Author a, Book b
WHERE a.id = b.author_id
GROUP BY a.id, a.nameIs it possible to get these results by only changing the templates? Or do I need to write a plugin?
Jasper
http://www.bookings.org
In my famous Books and Authors example (each author writes multiple books, each book has one author), the Books table contains a column with the price of the book. Now I want to show a table with for each author the sum of the prices of all books for that author. So I have the following tables:
Code:
Author: id, name Book: id, author_id, title, price
Code:
SELECT a.id, a.name, SUM(b.price) FROM Author a, Book b
WHERE a.id = b.author_id
GROUP BY a.id, a.name
Jasper
http://www.bookings.org