Re: [sqlite] A little help with count

2007-01-13 Thread Cesar Rodas

select count(id), "numrows" as type from table
union
select count(id), "inrows" as type from table where direction = 'In'
union
select count(id) as id, "outrows" as type from table where direction = 'Out'


This could be?
I am sorry that i can't try here, because i am not in my work or my home,
and here i don't have SQLite... try and tell if it works or not.

Best Regards

On 13/01/07, Lloyd Thomas <[EMAIL PROTECTED]> wrote:



I wish to create a query where I do a number of counts on the same table
but
with different filters.
ie:
count(id) as numrows
count(id) as inrows where direction = 'In'
count(id) as outrows where direction = 'Out'

Could I do the above in a single query?

| id |  date  | direction | duration | cost |
| 1 |2007-01-01|In| 56 | 0.00 |
| 2 |2007-01-01|   Out  | 60 | 0.10 |
| 3 |2007-01-02|   Out  | 47 | 0.10 |
| 4 |2007-01-02|In| 120   | 0.20 |


Thx
Lloydie T



-
To unsubscribe, send email to [EMAIL PROTECTED]

-





--
Cesar Rodas
http://www.sf.net/projects/pagerank (The PageRank made easy...)
Mobile Phone: 595 961 974165
Phone: 595 21 645590
[EMAIL PROTECTED]
[EMAIL PROTECTED]


[sqlite] A little help with count

2007-01-13 Thread Lloyd Thomas


I wish to create a query where I do a number of counts on the same table but 
with different filters.

ie:
count(id) as numrows
count(id) as inrows where direction = 'In'
count(id) as outrows where direction = 'Out'

Could I do the above in a single query?

| id |  date  | direction | duration | cost |
| 1 |2007-01-01|In| 56 | 0.00 |
| 2 |2007-01-01|   Out  | 60 | 0.10 |
| 3 |2007-01-02|   Out  | 47 | 0.10 |
| 4 |2007-01-02|In| 120   | 0.20 |


Thx
Lloydie T 



-
To unsubscribe, send email to [EMAIL PROTECTED]
-