One of the famous complains of the developers who switched from SQL background (For example Me :-)) to SharePoint development; is how to query related lists with joins instead on looping and filtering both of them using different queries.
You can Achieve this using the SPQuery.Joins Property.
Example:
You can Achieve this using the SPQuery.Joins Property.
Example:
Source: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spquery.joins%28v=office.14%29.aspx