I've been using SQL in mirc for over 2 years, theres an easier way if you happen to run a MySQL server on your comp.
Theres a dll called
mIRC MySQL v1.6.1It includes how to use it within mirc, for more info about using dll in mirc /help dll and /help $dll
.. should be in the same section of the help file anyways.
have fun.