Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • SELECT first_name,
                        last_name,
                        order_date,
                        SUM(COALESCE(price, 0)) AS total
    FROM customer
    LEFT JOIN orders ON customer.id = orders.customer_id
    LEFT JOIN order_item ON orders.id = order_item.order_id
    GROUP BY first_name, last_name, order_date
    HAVING total 15
    ORDER BY order_date ASC

    there, fixed it for you. any math on a NULL needs to have the ability to deal with a non-NULL value. there is a standard SQL function just for this very issue.