Nevermind...figured it out:

users =
Loan.objects.filter(lender_id=lender_id).values("borrower_id").distinct()

On Mar 27, 3:43 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I have a table that is something like the following
>
> loan_id
> lender_id
> borrower_id
> ...other loan information
>
> I have a query that is by lender_id
>
> loans = Loans.objects.filter(lender_id=lender_id)
>
> My question is...from those loans...how do I retrieve a list of the
> unique borrowers?
>
> For example if 'lenderXYZ' has 100 loans.... 20 are for 'borrower1',
> 20 are for 'borrower2', 60 are for 'borrower3' ... I want to know if
> there is a way to just get a list back that says
> 'borrower1','borrower2','borrower3' (or their id's) ... so I can fill
> a drop down box with those three.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to