Archive for March, 2007

Delete from table using a join

Wednesday, March 28th, 2007

MySQL won't let you delete from a table using a subquery that references itself. Fair enough. To get around this, up till now, I've used temporary tables. However, I've never really liked it, and I've always wanted a JOIN delete. Well, apparently it exists. I'm cleaning ...

Awk does not work as expected with double quotes

Thursday, March 22nd, 2007

Of course, I felt like an idiot after being completely confused by this for about half an hour. Consider this: awk "{print $1}" somefile.txt This does not work as I had expected. The reason is because the $1 is evaluated within double quotes, (not single quotes). Yes, it's a ...

Using a result set to call stored procedures for ad hoc queries

Friday, March 9th, 2007

Using mysql -e's feature, combined with awk and xargs, I was able to call an existing stored procedure repeatedly for a resultset. Yes, I could have written another stored procedure to do this, I realize. But I guess I like doing things the hard way. Either that, ...