summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-06-12 13:19:37 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-06-12 13:19:37 +0000
commitb9113ca81f553489001882ba95daa415d3652e81 (patch)
tree50d7c6699c821c32feda6ba60c114dd6511ccf53 /docs
parentac5b9f585735d49ac61e80cca7d977325c799beb (diff)
Fixed #7327 -- Added documentation and test case for defining subqueries. Thanks, Sebastian Noack.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7625 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/db-api.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/db-api.txt b/docs/db-api.txt
index a15c45d37b..c94eb00f9e 100644
--- a/docs/db-api.txt
+++ b/docs/db-api.txt
@@ -1373,6 +1373,17 @@ SQL equivalent::
SELECT ... WHERE id IN (1, 3, 4);
+You can also use a queryset to dynamically evaluate the list of values
+instead of providing a list of literal values. The queryset must be
+reduced to a list of individual values using the ``values()`` method,
+and then converted into a query using the ``query`` attribute::
+
+ Entry.objects.filter(blog__in=Blog.objects.filter(name__contains='Cheddar').values('pk').query)
+
+This queryset will be evaluated as subselect statement::
+
+ SELET ... WHERE blog.id IN (SELECT id FROM ... WHERE NAME LIKE '%Cheddar%')
+
startswith
~~~~~~~~~~