Net worth

Spent entirely too much time on the calls database this weekend. A lot of hacking perl and mysql was involved. Even managed to break the sql server in the process. It seems that if you do a select from multiple tables but don't put in the links properly, it generates rows over and over again. I don't know how many lines it was going to return, but it generated a 200mb temp file before the partition filled up. Later when I did a similar select on just a small fraction of the database, it returned over 2000 lines. Still haven't figured out the code properly, need to figure out how to do joins.

But I did get a bit of an admin interface working, where clicking on the categories prints out a summary of each entry. And I think I got a nifty date select working, that selects everything since the previous Sunday. Can anyone suggest anything better/more elegant/more compact than this:

select * from calls where date > DATE_SUB(DATE_FORMAT(now(), '%Y-%m-%d'), INTERVAL DAYOFWEEK(now()) day);