How to Write Complex SQL Sub-query

Here is a sample sub-query. Here you will read records from two tables. Also explained how the query works.