Try this:

select
avg(age)
from acoda
union all
select
avg(durata)
from main
union all
select
sum(età)
from dipendenti


RBS


-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of silvio grosso
Sent: 10 January 2009 10:41
To: sqlite-users@sqlite.org
Subject: [sqlite] newbie question regarding my sqlite code

Hello,

I am a new sqilte user and I am learning sqlite code in my spare time..
I have always used sql code with Microsoft Access and Base (openoffice).
Therefore, sorry to ask a question very simple .

When I write the very simple code:
select sum(età) from dipendenti
everything works fine and the result is 100.

When
I try a bit longer query the result for the sum regarding the column
età from the table dipendenti changes and it is wrong. That is 25200?
(instead of the right value 100!).

The query is:
select avg(age), avg(durata), sum(età) from acoda, main, dipendenti

In
the above query the avg results for the column age (table acoda) and
the column durata (table main) are right. The only value wrong is the
third, that it, sum (for the table dipendenti, column age, 25200 instead of
the right value 100).
The column age in the table dipendenti is not present in the other two
tables (acoda, main).

What's wrong with the second query?


Thanks in advance.

Best regards



      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to