Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Join

0 views
Skip to first unread message

rjre

unread,
Nov 23, 2009, 10:39:43 AM11/23/09
to
Afternoon all...

Can someone help me with a join...as I now have no hair and am having
trouble typing because of all the caffine...

I have three tables: TABLE1, TABLE2 and TABLE3.

All tables have the IDENTIFIER, QUANTITY and DATE.

What I would like is to be able to produce a query that gives a list
(for CURDATE()) a list of identifiers and quantities where each
identifier is shown once but if they appear in multiple tables to sum
the resulting quantities together...

thank you very much

richard

Lennart

unread,
Nov 23, 2009, 11:25:23 AM11/23/09
to

I'm not sure I understand your question, but it sounds like what you
need is a union, not a join (even though it might be possible to
express the same thing via joins, it is not very intuitive). Is this
what you mean?

select identifier, some_date, sum(quantity) from (
select identifier, some_date, quantity from t1
union all
select identifier, some_date, quantity from t2
union all
select identifier, some_date, quantity from t3
) x group by identifier, some_date;


/Lennart

Jerry Stuckle

unread,
Nov 23, 2009, 11:29:48 AM11/23/09
to

Richard,

Your question is confusing. How about the layout of your tables, some
sample data, and the results you hope to achieve?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

toby

unread,
Nov 23, 2009, 12:10:19 PM11/23/09
to
On Nov 23, 10:39 am, rjre <rjredwa...@googlemail.com> wrote:
> Afternoon all...
>
> Can someone help me with a join...as I now have no hair and am having
> trouble typing because of all the caffine...
>
> I have three tables: TABLE1, TABLE2 and TABLE3.
>
> All tables have the IDENTIFIER, QUANTITY and DATE.

If these are the same entity why are they in 3 tables?

rjre

unread,
Nov 23, 2009, 12:12:46 PM11/23/09
to
> /Lennart- Hide quoted text -
>
> - Show quoted text -

perfect! - thx vm

0 new messages