Broken SQL

Ovid on 2007-10-03T12:46:03

As it turns out, my previous query is terribly broken because of a bug in SQL. In the original relational model, only sets of data are returned, not bags (which allow duplicates). As it turns out, under the covers I'm getting duplicate results returned and summed. Fixing it turns out to be trivial ... if I had a new enough version of MySQL. 4.0.18 doesn't allow subselects.

I have several choices to fix it. I can try and invert it and use RIGHT JOINs or try and alter one of the tables to include some dates that are forcing one of the extra LEFT JOINs. I could also give up and fall back to summing a lot of the data in Perl, but that's much slower :(

I was supposed to have this data days ago. I hate SQL.