join query to get the maximum value in django orm

15 views
Skip to first unread message

Rajshree Some

unread,
Jul 13, 2020, 4:48:53 AM7/13/20
to Django users
Table1
id                              name                        comment

1

Item1

Bad

2

Item2

Good

 


 

Table2

Id                                                             table1_id                                             marks         

1.

1

23

2.

1

54

3.

2

66

4.

2

55


I want to write a single query to fetch the maxium marks of each item and update the parent table each item comment with bad if the max is less 60 and good if the max is greater that 60
Reply all
Reply to author
Forward
0 new messages