Reputation: 31548
I have few things to ask for custom queries in Django
Person.objects.raw('SELECT id, first_name, last_name, birth_date FROM Person A
inner join Address B on A.address = B.id
')
or B.id = A.address_id
Upvotes: 0
Views: 426
Reputation: 8491
You need to use the database's table and field names in the raw query--the string you provide will be passed to the database, not interpreted by the Django ORM.
Upvotes: 3