Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Strange bug in 10.2.0 involving merging rows from one table into another
> insert into dest_table (column_z, column_1, column_2,...)
> select COUNT(*), column_1, column_2,..., column_N,
> SUM(column_a), MIN(column_b), MAX(column_c),...
> from source_table
> group by column_1, column_2,...,column_N
>
> I would expect that SUM(dest_table.column_z) would equal
> COUNT(source_table.*), but they are off by about 40 rows - in other
> words, 40 rows in source_table are not being included in the select.
The SUM function will total all of the numbers in that column. The COUNT function will give the number of rows. Why is it expected that both would be equal? Unless dest_table.column_z contains all 1's, then the SUM and the COUNT will not be equal.
I must be missing something....
Cheers,
Brian
-- =================================================================== Brian Peasland oracle_dba_at_nospam.peasland.net http://www.peasland.net Remove the "nospam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three" - UnknownReceived on Mon Apr 24 2006 - 10:26:57 CDT
![]() |
![]() |