On Wednesday 31 May 2017 12:13:48 'Abraham Varricatt' via Django users
wrote:
> If I want to get the total count from both tables it can be done like
> this,
>
> author_count = Author.objects.count()
> publisher_count = Publisher.objects.count()
>
> My concern is that this results in two
On Wed, May 31, 2017 at 3:01 PM, Alceu Rodrigues de Freitas Junior <
alceu.freitas...@gmail.com> wrote:
> Hi James,
>
> I'm curious... why dropping down from the ORM and doing a single query
> wouldn't be portable?
>
> I understand that it would happen if you use some kind of stored procedure
>
Hi James,
I'm curious... why dropping down from the ORM and doing a single query
wouldn't be portable?
I understand that it would happen if you use some kind of stored
procedure in the DB, but I guess a single ANSI SQL would do it.
Thanks!
- Alceu
Em 31/05/2017 17:29, James Schneider
PM
> *To:* Django users
> *Subject:* count from multiple tables in a single query?
>
>
>
> Hello,
>
> Is it possible to get the count of entries from multiple tables in a
> single query call? I'm looking at the official docs on aggregation and I
> can't find a
@googlegroups.com]
Sent: Wednesday, May 31, 2017 2:14 PM
To: Django users
Subject: count from multiple tables in a single query?
Hello,
Is it possible to get the count of entries from multiple tables in a single
query call? I'm looking at the official docs on aggregation and I can't find
anything
>
>
> If I want to get the total count from both tables it can be done like this,
>
> author_count = Author.objects.count()
> publisher_count = Publisher.objects.count()
>
> My concern is that this results in two different queries to the database.
> Can it be done with a single query call?
>
>
Hello,
Is it possible to get the count of entries from multiple tables in a single
query call? I'm looking at the official docs on aggregation and I can't
find anything. For example assume I have the following 2 tables,
class Author(models.Model):
name = models.CharField(max_length=100)
7 matches
Mail list logo