On Fri, Feb 27, 2009 at 2:40 PM, Bobby Roberts <[email protected]> wrote:
>
> hi all. I have a situation where I have two tables, auctions and
> bids. I need to do a subquery as such:
>
> select distinct id from auctions_auction where Active=1 and id IN
> (select distinct AuctionId_id from auctions_bid where BidderId=6)
>
>
> how would I do this in django?
> >
>
Without knowing your table structure I'd say it's something like:
Auction.objects.values_list('id',
flat=True).filter(active=1).filter(id__in=Bid.objects.filter(bidder_id=6).values('auction_id'))
on svn or
Auction.objects.values_list('id',
flat=True).filter(active=1).filter(id__in=Bid.objects.filter(bidder_id=6).values('auction_id').query)
on 1.0
--
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---