I recently asked a similar question that involved MySQL, maybe it will help you out: http://elitetrader.com/vb/showthread.php?s=&threadid=63745