Sorry for the late reply. I have only just noticed the solution above.
Dalecosp your solution doesn't seem to work for me.
But even if it did, I would not have used it, as I need a pure SQL solution and no PHP included.
This is because I plan to run a schedule procedure in my MySQL application and not a PHP script as I might have incorrectly suggested earlier.
Thanks for the help again.