grouping ...

J

jer

columnA ColumnB ColumnC columnD
12345 23 78956 10.00
12345 23 89153 15.00
56780 23 15687 20.00
56780 23 15890 20.00
12345 23 78853 30.00
12345 23 87568 30.00

I am importing a table from an external source structured as above
and if I sum columnD based on grouping on columnA I would get total
for
12345 = 85.00 4 detail records
56780 = 40.00 2 detail records

what I want to get however is
12345 = 25.00 2 detail records
56780 = 40.00 2 detail records
12345 = 60.00 2 detail records

Apart from grouping is there any other query I can build that
would give me the expected result
 
J

John W. Vinson

columnA ColumnB ColumnC columnD
12345 23 78956 10.00
12345 23 89153 15.00
56780 23 15687 20.00
56780 23 15890 20.00
12345 23 78853 30.00
12345 23 87568 30.00

I am importing a table from an external source structured as above
and if I sum columnD based on grouping on columnA I would get total
for
12345 = 85.00 4 detail records
56780 = 40.00 2 detail records

what I want to get however is
12345 = 25.00 2 detail records
56780 = 40.00 2 detail records
12345 = 60.00 2 detail records

Apart from grouping is there any other query I can build that
would give me the expected result

I don't understand your question. Tables have no order; the only things you
can use for grouping are values actually stored in the records in the table.
Are you assuming that the first two 12345 rows are somehow "grouped" already?
Because they aren't!

More info please.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top