Thank you all!
My problem has been solved in another way... because the inner queries
had left outer joins and so on, and I finally have had to do two queries
and treat results by PHP.
Again... thank you all!
---(end of broadcast)---
TIP 2: Don'
... SELECT tot.status, COUNT(total)
FROM( QUERY A UNION QUERY B ) AS tot
GROUP BY tot.status
But it doesn't works. It doesn't add the total columns with the same
status...
...
I guess you have two problems, if I understand what you're trying to do.
- As Roberto Spier noted, 'sum' would be be
Dani Castaños escreveu:
...
And have the result of both added.
I've tried something like
SELECT tot.status, COUNT(total)
Should be
SELECT tot.status, SUM(total)
FROM( QUERY A UNION QUERY B ) AS tot
GROUP BY tot.status
But it doesn't works. It doesn't add the total columns with the same
s
Στις Δευτέρα 16 Ιούλιος 2007 14:06, ο/η Dani Castaños έγραψε:
> Hi all!
>
> I want to do something like this:
>
> SELECT status, COUNT( status ) AS total
> FROM users
> GROUP BY status
>
> UNION
>
> SELECT status, COUNT(status) AS total
> FROM imported_users
> GROUP BY status
>
>
> And have the res
Hi all!
I want to do something like this:
SELECT status, COUNT( status ) AS total
FROM users
GROUP BY status
UNION
SELECT status, COUNT(status) AS total
FROM imported_users
GROUP BY status
And have the result of both added.
I've tried something like
SELECT tot.status, COUNT(total)
FROM( QU