Answers for "Exception Value: Raw query must include the primary key"

SQL
0

raw query must include primary key

queryset=country_model.objects.raw('SELECT myapp_country_model.cname,myapp_state_model.sname FROM myapp_country_model INNER JOIN myapp_state_model on myapp_country_model.id=myapp_state_model.cid_id')
Solution
queryset=country_model.objects.raw('SELECT myapp_country_model.id,myapp_country_model.cname,myapp_state_model.sname FROM myapp_country_model INNER JOIN myapp_state_model on myapp_country_model.id=myapp_state_model.cid_id ')
Posted by: Guest on October-22-2021

Code answers related to "Exception Value: Raw query must include the primary key"

Code answers related to "SQL"

Browse Popular Code Answers by Language