Обсуждение: many to many relationship Query ?

Поиск
Список
Период
Сортировка

many to many relationship Query ?

От
"Morris, Sam@EDD"
Дата:
I am having problems composing query.  I would like to compare the sums of
each table for a given date.
I have two tables :

T1.date        T1.Amount
06/07/64    $1
06/07/64    $3

T2.date        T2.date
06/07/64    $10
06/07/64    $20

I would like an output of :
T1.date        Sum(T1.amount)    Sum(T2.Amount)
06/07/64    $4            $30

I have tried:
select T1.date, Sum(T1.amount), Sum(T2.Amount)
from T1, T2
where T1.date="06/07/64" and T2.date="06/07/64"
group by T1.date;
This unfortunatly generates:
T1.date        Sum(T1.date)        Sum(t2.date)
06/07/64    $8            $30
What is the best way to do this?