Kimball Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Summary Record

2 posters

Go down

Summary Record Empty Summary Record

Post  Balas Thu Jul 19, 2012 11:45 pm

Hi Experts-

Please provide the possible solution for the below query-

Master_Table-

ID_Col Ref_Num Status
222 A123 P
222 A123 A
222 A123 F
222 A123 K
222 A123 T
111 B123 P
111 B123 T
111 B123 K
111 B123 F

Records with value A in the Status column (Master_Table) will only consider as Active records rest will be consider Inactive records.

From the above table, our script should give a single record per ID_col/Ref_Num based on the Status columns as below,

Subset_Master-

ID_Col Ref_Num No_Active_Status No_Inactive_Status Total_Status
222 A123 1 4 5
111 B123 0 4 4

For ID_Col 222 the No_Active_Status is 1 because this ID contains only 1 A, the rest will be consider No_Inactive_Status and the Total_Status is No_Active_Status+No_Inactive_Status.
For ID_Col 111 the No_Active_Status is 0 because there is no A status, the rest will be consider No_Inactive_Status and the Total_Status is No_Active_Status+No_Inactive_Status.

Thanks In advance.

-Balas

Balas

Posts : 11
Join date : 2012-04-26

Back to top Go down

Summary Record Empty Re: Summary Record

Post  ngalemmo Fri Jul 20, 2012 3:35 am

Check your database manual to see if it supports a CASE, IF or DECODE function in a column expression. Use it to check the status value and return either 0 or 1 in each column. Enclose each expression with a sum(...).
ngalemmo
ngalemmo

Posts : 3000
Join date : 2009-05-15
Location : Los Angeles

http://aginity.com

Back to top Go down

Summary Record Empty Summary Record

Post  Balas Wed Jul 25, 2012 6:03 pm

Thanks for your time and suggestion.


Balas

Posts : 11
Join date : 2012-04-26

Back to top Go down

Summary Record Empty Re: Summary Record

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum