Read this thread and post. I can review more later, but It may give what you need.
He gave the SQL commands he used. They may be appropriate for you as well.