Your question is not clear. And changing midway from TableA to Horses doesn't help either.
Please visit this link: http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/[/url] to find out what information we need to help you, and how to collect and post that information.