Mark

You don't realy want a join (outer or otherwise) as this will give you
a product of the 3 tables, I'd suggest a view and then a sum

Not sure on sybase but something like

create view temp as
select Timestamp1, 1 as Table1, 0 as Table2, 0 as Table3 from table1
union
select Timestamp1, 0 as Table1, 1 as Table2, 0 as Table3 from table2
union
select Timestamp1, 0 as Table1, 0 as Table2, 1 as Table3 from table3

and then

select Timestamp1, sum(Table1)  as Table1Count, sum(Table2)  as Table2Count,
sum(Table3)  as Table2Count
group by Timestamp1

also in yout temp view you could put multiple entires from a single table to
get your time span counts, ie foo() returns the interval

ie
create view temp as
select Timestamp1, 1 as Table1, 0 as Table2, 0 as Table3 from table1
where foo(Timestamp1) = 0
union
select Timestamp1, 1 as Table1, 0 as Table2, 0 as Table3 from table1
where foo(Timestamp1) = 1
.....

This could all be done in a stored proc

HTH

Neven
----- Original Message -----
From: "Mark Derricutt" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Tuesday, March 11, 2003 3:10 PM
Subject: [DUG]: outer join syntax refreshers


> Arrrrg - my heads gone and forgotten outer join stuff.
>
>
> I have three tables, each with a timestamp, and other fields, and I want
to
> get a count result something like:
>
> timestammp , table1_count, table2_count, table3_count
>
> THis is for sybase.
>
> To make it worse, I want the break them down into hour/day blocks...
>
>
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to