Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

My table has data like:

country 	date 	count
India 	01-10-2017 	49
USA 	03-10-2017 	42
Japan 	04-10-2017 	55
Russia 	01-10-2017 	87
UK 	02-10-2017 	17
UAE 	03-10-2017 	13
Australia 	04-10-2017 	63
India 	01-10-2017 	38
USA 	02-10-2017 	67
USA 	03-10-2017 	73
Japan 	01-10-2017 	70
Russia 	02-10-2017 	17
UK 	03-10-2017 	87
Australia 	04-10-2017 	40
UK 	02-10-2017 	30
UAE 	03-10-2017 	22
Australia 	04-10-2017 	78
India 	03-10-2017 	13
USA 	04-10-2017 	3
USA 	04-10-2017 	41
Japan 	01-10-2017 	95
Russia 	02-10-2017 	12
UK 	03-10-2017 	42
Australia 	04-10-2017 	88
UK 	01-10-2017 	3
Japan 	02-10-2017 	16

I have to pivot the data and find sum of count for each country for each day and also for every two days.

Output for each day will look like:
country 	01-10-2017 	02-10-2017 	03-10-2017 	04-10-2017
Australia 	0	0	0	269
India 	87	0	13	0
Japan 	165	16	0	55
Russia 	87	29	0	0
UAE 	0	0	35	0
UK 	3	47	129	0
USA 	0	67	115	44
Grand Total 	342	159	292	368


And data for each 2 days will look like:

country 	 1st 2days 	 last 2 days
Australia 	0	269
India 	87	13
Japan 	181	55
Russia 	116	0
UAE 	0	35
UK 	50	129
USA 	67	159
Grand Total 	501	660


I am using oracle 10g with C#.

Any help?

What I have tried:

I searched to find out that data can be pivot but that does not work with 10g!!
Posted
Updated 13-Oct-17 6:55am
v2
Comments
Maciej Los 12-Oct-17 10:45am    
You did not provide details about what you have tried...
j snooze 12-Oct-17 17:37pm    
Maybe this will help.
https://stackoverflow.com/questions/13410464/pivot-on-oracle-10g

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900