Home > Software engineering >  Example of a Django query set
Example of a Django query set

Time:11-17

I would like to have an example of a django query that allows you to select elements contained in two different tables in a database in a single query

data = Insuree.objects.filter(gender = 'F').count()
data2 = Service.objects.filter(code = 'F4').count()

CodePudding user response:

You can combine queries with the | character.

data = Insuree.objects.filter(gender = 'F').count() | Service.objects.filter(code = 'F4').count()
  • Related