SELECT command denied to user 'wacms'@'18.104.22.168' for table 'productsubcategories'
hehe! Whooho, okey, that did not work! Go back to what you had from start, and remove the repeat region for the rsShowCat. Dont think you need it.
Els do a SQL dump on the two tables you got and attach them as a text file, so i can make the right query for you, if you think you will need it in the future.