diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index eaf2cd2..be878a4 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -449,13 +449,20 @@ class SQLCompiler(object):
                 result.append('%s%s%s' % (connector, qn(name), alias_str))
             first = False
         for t in self.query.extra_tables:
+            if isinstance(t, tuple):
+                t, subselect = t
+            else:
+                subselect = None
             alias, unused = self.query.table_alias(t)
             # Only add the alias if it's not already present (the table_alias()
             # calls increments the refcount, so an alias refcount of one means
             # this is the only reference.
             if alias not in self.query.alias_map or self.query.alias_refcount[alias] == 1:
                 connector = not first and ', ' or ''
-                result.append('%s%s' % (connector, qn(alias)))
+                if subselect is None:
+                    result.append('%s%s' % (connector, qn(alias)))
+                else:
+                    result.append('%s%s as %s' % (connector, subselect, qn(alias)))
                 first = False
         return result, []
 
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 0913399..0234f4b 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1637,7 +1637,11 @@ class Query(object):
         if where or params:
             self.where.add(ExtraWhere(where, params), AND)
         if tables:
-            self.extra_tables += tuple(tables)
+            # allow tables to be dictionaries mapping names to subselects
+            if hasattr(tables, 'items'):
+                self.extra_tables += tuple(tables.items())
+            else:
+                self.extra_tables += tuple(tables)
         if order_by:
             self.extra_order_by = order_by
 
