List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:January 13 2005 7:39pm
Subject:Re: counting records in 2 tables using 1 query
View as plain text  
How about ...

select @a:=count(*) from ... where ...
union
select @b:=count(*) from ... where ...
union
select @a+@b;

PB

---

2wsxdr5 wrote:

> I have these 2 queries.
>
> SELECT count(*) gifts
> FROM   gift g
> WHERE g.this and g.that
>
> SELECT count(*) events
> FROM   events e
> WHERE e.this and e.the other thing
>
> is there a way to put these into one query.....
>
> SELECT count(g.*) gifts, count(e.*)
> FROM gift g, event e
> WHERE . . . .
>
> so far nothing seems to be working
>

Thread
counting records in 2 tables using 1 query2wsxdr513 Jan
  • Re: counting records in 2 tables using 1 queryPeter Brawley13 Jan
  • Re: counting records in 2 tables using 1 querySGreen13 Jan
    • Re: counting records in 2 tables using 1 query2wsxdr514 Jan
      • Re: counting records in 2 tables using 1 querySGreen14 Jan