Subject | Re: group by ?? |
---|---|
Author | danyschaer |
Post date | 2008-06-10T14:19:36Z |
Hi ALL;
I have to thank all of you; both, SEAN LEYNE and HELEN ideas works very
well. I didn't try SET's idea because yet (thank you Set !!!). I first
didn't understand that, because I did an error when tried them.
But now I see that the two are very good. I selected to use HELEN
sintaxis for my project. The most important thing of both solutions is,
that it is easy to combine them with filters in main table, without
doing a first index in the related table (that can be very big), so in
real cases the solutions you suggested me works very fine and quickly.
For example:
select "PROC"."PROC","PROC"."EXP1"
as "EXPE","PROC"."ACTO","PROC"."DEMA","PROC"."OBSE","TPRO"."DSCR"
as "D_TPRO", "mv1"."FECH", "mv1"."DSCR" from "PROC" left outer
join "TPRO" on "PROC"."TPRO"="TPRO"."TPRO" left outer join "MOVI" "mv1"
on "PROC"."PROC"="mv1"."PROC" where (("PROC"."PROC" in (select "PROC"
from "PROC" where ("PROC"."INIC" between '20040101' and '20041231')))
and ("mv1"."FECH"||"mv1"."HORA"=(select max("mv2"."FECH"||"mv2"."HORA")
from "MOVI" "mv2" where "mv1"."PROC"="mv2"."PROC"))) order by lower
("PROC"."ACTO")
returns me 2230 PROCs in just 3 or 4 seconds, what is very fast
BTW, I don't use timestamps because a few things ...; but one is that I
try to make my project to work with any database engine, and I don't
know how far all the databases and the dbexpress drivers are
compatibles in datatypes, so I always use strings for all the columns.
I repead what I said once, this forum is amazing!!!.
Thank you very very much.
Dany
I have to thank all of you; both, SEAN LEYNE and HELEN ideas works very
well. I didn't try SET's idea because yet (thank you Set !!!). I first
didn't understand that, because I did an error when tried them.
But now I see that the two are very good. I selected to use HELEN
sintaxis for my project. The most important thing of both solutions is,
that it is easy to combine them with filters in main table, without
doing a first index in the related table (that can be very big), so in
real cases the solutions you suggested me works very fine and quickly.
For example:
select "PROC"."PROC","PROC"."EXP1"
as "EXPE","PROC"."ACTO","PROC"."DEMA","PROC"."OBSE","TPRO"."DSCR"
as "D_TPRO", "mv1"."FECH", "mv1"."DSCR" from "PROC" left outer
join "TPRO" on "PROC"."TPRO"="TPRO"."TPRO" left outer join "MOVI" "mv1"
on "PROC"."PROC"="mv1"."PROC" where (("PROC"."PROC" in (select "PROC"
from "PROC" where ("PROC"."INIC" between '20040101' and '20041231')))
and ("mv1"."FECH"||"mv1"."HORA"=(select max("mv2"."FECH"||"mv2"."HORA")
from "MOVI" "mv2" where "mv1"."PROC"="mv2"."PROC"))) order by lower
("PROC"."ACTO")
returns me 2230 PROCs in just 3 or 4 seconds, what is very fast
BTW, I don't use timestamps because a few things ...; but one is that I
try to make my project to work with any database engine, and I don't
know how far all the databases and the dbexpress drivers are
compatibles in datatypes, so I always use strings for all the columns.
I repead what I said once, this forum is amazing!!!.
Thank you very very much.
Dany