# Miscellaneous > Structured Query Language (SQL) >  T-Sql Query Help

## dotnetmamma

I have a problem that is beyond my current knowledge.  

I am trying to create a query similar to the following

"Select field1, field2, (Select field3 from table1 where field3 = field2) From table2 where field 1 = value"

I know this won't work because the subquery is done before the main query so It can't compare to a field in the main query. Is there a way to accomplish this. I hope this makes sense, thanks for any help.
Laura

----------


## dotnetmamma

I was making it harder than it really was, I think I figured it out. I used an inner join. 

SELECT tblContent.ForeignKey AS contentFK, tblContent.Title, tblLinks.LinkURL, tblLinks.LinkParentMenuNone, tblLinks.MenuItemLinked, tblLinks.SortOrder, tblLinks.ForeignKey, tblLinks.Published FROM  tblContent INNER JOIN tblLinks ON tblContent.ForeignKey = tblLinks.ForeignKey WHERE (tblLinks.LinkParentMenuNone = 'parent') AND (tblLinks.Published = 1)ORDER BY tblLinks.MenuItemLinked, tblLinks.SortOrder

----------

