The join is irrelevant. Your join returns a resultset and you can just
pretent that resultset is a single table:

SELECT field1, field2, field3
FROM (very complicated join) AS simpletable
GROUP BY ...
WITH ROLLUP

Just copy-pate your join into this and fix the fieldnames.


aaahhh....

okay, i'm close:

mysql>  select    ticket_details.quantity,
                  product.name,
                  product.price,
                  (product.price * ticket_details.quantity) as subtotal
        from      product,
                  ticket_details
where ticket_details.ticket = '9f2d7b86-213d-1028-88b7-09e76b61a517' AND
                  ticket_details.product = product.id
        group by subtotal
        with rollup
        ;

+----------+--------+-------+----------+
| quantity | name   | price | subtotal |
+----------+--------+-------+----------+
|        1 | orange |  0.97 |     0.97 |
|        3 | pear   |  1.09 |     3.27 |
|        3 | pear   |  1.09 |     NULL |
+----------+--------+-------+----------+


the NULL is in the wrong column.  where is my mistake?

thanks, jochem.

- philip



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to