M
Member 310024
Guest
*
I have created a temp table (t1)
which contains 3 fields ( f1, f2 & f3 ).
*
f1 is may not be unique.
*
I would like to create 3 more temp tables (t2, t3 & t4).
*
t2 is to contain t1 recs that have a f1 count(*) of 1.
*
t3 is to contain one rec for each unique t1.f1 value,
together with it's f1 count(*) value.
*
t4 is to contain one rec for each unique t1.f1 value,
and the highest t1.f2 & t1.f3 value for that t1.f1 value.
(f2 & f3 are like a date & time - so, the highest date & time)
*
Does anyone have a reference to a truely brilliant SQL cookbook
that is suitable for my tiny brain to understand how to do this?
*
I've tried things like select distinct, group by, count(*) and
I'm sure the solution is to somehow combine these, but I've
never really "GOT" the syntax of more that basic SQL, and the
logic of complex SQL statements still evades me.
*
I have created a temp table (t1)
which contains 3 fields ( f1, f2 & f3 ).
*
f1 is may not be unique.
*
I would like to create 3 more temp tables (t2, t3 & t4).
*
t2 is to contain t1 recs that have a f1 count(*) of 1.
*
t3 is to contain one rec for each unique t1.f1 value,
together with it's f1 count(*) value.
*
t4 is to contain one rec for each unique t1.f1 value,
and the highest t1.f2 & t1.f3 value for that t1.f1 value.
(f2 & f3 are like a date & time - so, the highest date & time)
*
Does anyone have a reference to a truely brilliant SQL cookbook
that is suitable for my tiny brain to understand how to do this?
*
I've tried things like select distinct, group by, count(*) and
I'm sure the solution is to somehow combine these, but I've
never really "GOT" the syntax of more that basic SQL, and the
logic of complex SQL statements still evades me.
*