Core: fixed typos in SQL

 - fixed getting all resources by specific tag
 - fixed getting all tags by specific resource