how keep details about an agregated record

General
General covers Articles, Reference documentation, FAQs, Downloads and Blogs that do not belong to a specific subject area. General-purpose Articles about everything and anything
Highlighted
Enthusiast

how keep details about an agregated record

Hello i have the following table :

 

  acc     ID     col1 col2  col3    TOTAL_WO

1234ss010                     2
1234cc100                     1

after aggregating on 'acc' i get the follwoing table:

 

  acc      col1 col2   col3         TOTAL_WO

1234110                                  3

 

but i want to get the following :

  acc     col1 col2   col3  TOTAL_WO_cc   TOTAL_WO_ss1

1234110                        1                         2

which is keeping the details of TOTAL_WO for the columns SS and CC .

 

any help please?

thank you .

 


Accepted Solutions
Teradata Employee

Re: how keep details about an agregated record

Not clear exactly what you want. Perhaps something as simple as

SUM(CASE WHEN ID = 'SS' THEN TOTAL_WO END) AS TOTAL_WO_SS

1 ACCEPTED SOLUTION
3 REPLIES 3
Teradata Employee

Re: how keep details about an agregated record

Not clear exactly what you want. Perhaps something as simple as

SUM(CASE WHEN ID = 'SS' THEN TOTAL_WO END) AS TOTAL_WO_SS

Teradata Employee

Re: how keep details about an agregated record

Hello,

 

You can use (PARTITION BY acc , ID)

Please let me know if it works,

 

Enthusiast

Re: how keep details about an agregated record

Hello,

the solution provided by Fred worked for me thanks fred, thanks marwan for your answer too .