Hy Maik,
you can select it directly from the tables using following sql statement
(but it's same as using views):
select
t1.id, t1.f1, t2.f2
from
(select id, sum(amount) f1
from table1
group by id) t1,
(select id, sum(amount) f2
from table2
group by id) t2
where
t1.id = t2.id
but,
I don't get it? What's the difference between an inner-join and an
equijoin?
"Nils Zonneveld" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> Maik wrote:
> >
> > Its clear, union concat the two results.
> >
> > But he can also use this join version, if its
"Maik" <[EMAIL PROTECTED]> wrote in message
news:<9na15r$ku4$[EMAIL PROTECTED]>...
> Its clear, union concat the two results.
>
> But he can also use this join version, if its the intention.
>
> select t1.id, sum(t1.amount), t2.id, sum(t2.amount) from table1 as t1,
> table2 as t2 where t1.id=t2
Maik wrote:
>
> Its clear, union concat the two results.
>
> But he can also use this join version, if its the intention.
>
> select t1.id, sum(t1.amount), t2.id, sum(t2.amount) from table1 as t1,
> table2 as t2 where t1.id=t2.id;
>
Yeps, thats another way to write an inner join :-)
Mazzel
Maik wrote:
>
> With "Union" you can create one view.
> Ciao Maik
UNION wouldn't have the desired effect:
the result of a UNION SELECT would look like this:
ID AMOUNT
1 (table1.amount)
2 (table1.amount)
. .
. .
1 (table2.amount)
2 (table2.amount)
What he wants is:
ID TABLE1.AMOUNT
Its clear, union concat the two results.
But he can also use this join version, if its the intention.
select t1.id, sum(t1.amount), t2.id, sum(t2.amount) from table1 as t1,
table2 as t2 where t1.id=t2.id;
Ciao Maik
---(end of broadcast)---
TIP