SQL Server: How to Get data from a table depending on another table using sub query

Published --