Sunday, February 14, 2010


useful site for mysql setup
You can download mysql (use MSI one, it is easy to work with) from here:

You need to set the path environment variable by (
My Computer > Properties > Advanced >Environment Variables > System variables > Path > Edit
and add the mysql installation path (e.g. C:\Program Files\MySQL\MySQL Server 5.1\bin)

MYSQL update with subquery on the same table doesn't work
This is very common in oracle and other sql based databases, but with MYSQL database currently, you cannot update a table and select from the same table in a subquery. The following query doesn't work: update t1 set col1='NO' where id=(select max(id) from t1)
Instead you can use the following hack:
update t1 set col1 = 'NO' order by id desc limit 1

No comments:

Post a Comment