Re: [SQL] Aggregate question (Sum)

2007-11-19 Thread Luiz K. Matsumura
Hi Rodrigo, thanks for reply Rodrigo De León wrote: On Nov 19, 2007 3:46 PM, Luiz K. Matsumura <[EMAIL PROTECTED]> wrote: If someone can give me some hint I will apreciate. This is more of a normalization problem. See: http://www.deeptraining.com/litwin/dbdesign/FundamentalsOfRelatio

Re: [SQL] Aggregate question (Sum)

2007-11-19 Thread Rodrigo De León
On Nov 19, 2007 3:46 PM, Luiz K. Matsumura <[EMAIL PROTECTED]> wrote: > If someone can give me some hint I will apreciate. This is more of a normalization problem. See: http://www.deeptraining.com/litwin/dbdesign/FundamentalsOfRelationalDatabaseDesign.aspx and lookup Third Normal Form. You have

[SQL] Aggregate question (Sum)

2007-11-19 Thread Luiz K. Matsumura
Hi All, I want to know if there are an easy manner to do an SQL like this bellow where TotalOrdersValue sum the order.total just one time per order (as count(DISTINCT order.id) do) SELECT order.dtorder , Count( DISTINCT order.fk_customer ) AS QtyCustomer , Count( DISTINCT order.id ) AS

Re: [SQL] EXPLAIN ANALYZE inside functions

2007-11-19 Thread Sabin Coanda
> > Do you know a workaround to do this ? > I just succeeded adding the following code: FOR rec IN EXECUTE 'EXPLAIN ANALYZE ' || sSQL LOOP RAISE NOTICE ' - %', rec; END LOOP; Regards, Sabin ---(end of broadcast)--- TIP 9: In versions be

[SQL] EXPLAIN ANALYZE inside functions

2007-11-19 Thread Sabin Coanda
Hi there, I'd like to rise the performance of a custom function, but I read somewhere I cannot use EXPLAIN ANALYZE to get the execution plan of the code from the function. Do you know a workaround to do this ? I tried to apply EXPLAIN ANALYZE statements inside my procedure hopping I will get