MrProgrammer
Programmer
I have two tables named "Main" and "RegionNames". Their descriptions are like below with sample records:
Main:
CutomerID Address Salary($):
2124441256 Gultepe 4000
3463112356 Antep 6000
2124447890 Pendik 7000
3463115838 Antep 3000
2124449900 Levent 4500
2124445543 Taksim 6200
.......... ....... ....
RegionNames:
RegionCode RegionName:
212444 ISTANBUL
346311 MARAS
...... ........
As can be seen, region codes are hidden in CustomerId (first 6 digits) fields. I want to prepare a report that show how many customers who have salary more and less then 5000$ there are in each region. A sample output must be like this:
Salary Less Than 5000$ Salary More Than 5000$
RegionCode RegionName Count Sum(Salary) Count Sum(Salary)
212444 ISTANBUL 2 8500 2 13200
346311 MARAS 1 3000 1 6000
How can I achieve this result? Do you have any ideas??? Thanks!
Main:
CutomerID Address Salary($):
2124441256 Gultepe 4000
3463112356 Antep 6000
2124447890 Pendik 7000
3463115838 Antep 3000
2124449900 Levent 4500
2124445543 Taksim 6200
.......... ....... ....
RegionNames:
RegionCode RegionName:
212444 ISTANBUL
346311 MARAS
...... ........
As can be seen, region codes are hidden in CustomerId (first 6 digits) fields. I want to prepare a report that show how many customers who have salary more and less then 5000$ there are in each region. A sample output must be like this:
Salary Less Than 5000$ Salary More Than 5000$
RegionCode RegionName Count Sum(Salary) Count Sum(Salary)
212444 ISTANBUL 2 8500 2 13200
346311 MARAS 1 3000 1 6000
How can I achieve this result? Do you have any ideas??? Thanks!