The Art of SQL by Stephane Faroult with Peter Robson The unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification This page was updated June 23, 2008. UNCONFIRMED errors and comments from readers: {158} Top lines of the page (Result Set Obtained by Aggregation, just above Simple or Range Searching on Dates); However, this use of having does not really make sense if amount is always a positive quantity or zero. In that event, we might be better using the following condition: where amount > 0 As far as I know, it is also possible to acknowledge negative values. There may only be a problem when the sum of all values adds up to be exactly 0 again, but only when using aggregates. Since we do not need to use aggregates, we can simply select any record with an amount not equal to 0 to find out "if there are any" and to retrieve the customer_id. So this clearly is an(other) advantage of not using aggregates: it also works for possible negative values combined with positive. Can you think of a way to achieve this by using aggregates? (Why would you want to anyway?) Yes, by first taking the absolute value of any amount and then summing them all up... But why do it the difficult way? {166} The rewritten query; The where clause of the rewritten SQL query is missing the condition "and type_code = 4" that was in the original query.