I once thouhgt about running a mySQL query, but the problem is that sometimes a tag has something inside, like a link with you would need to add string...
It is a but confusing, and you would need to run several queries for each tag.
BUT, i think it's possible.