SQL Query how to to get this Matrix report.

Hi All,
My tables are
Petty_cash_voucher P :- voucher_date,terminal_id,currency_code,account_code, amount
Terminal_master T :-
terminal_id,terminal_station_code
Ledger_codes L :- account_code,account_description,accound_main_head_code
Account_main_heads :-
Account_main_head_code, Main_head_description
im looking for a MATRIX WITH GROUP REPORT should look like this
1st group : CURRENCY
2nd Group : Main_head_description
Row field is : account_description
Column field is : Terminal_town_code
Matrix CELL is : total_amount.
here i should see all my terminal_towns though the transactuons existed or not for that day. letssay there are 22 terminals, but today i have 2 terminals only transactions, but i need to see 22 as columns with NULL values. and for ledgers, main_heads what ever existed only. Ex: i have 100 ledgers with 20 Main heds, but there is 2 only transactions happend, i should see 2 group by main_head with 2 terminsla having values remiaing termils with null values.
i wrote the query like this , but it is not giving all terminal codes , giving only values existed.
SELECT
P.currency_code,
T.terminal_town_code,
P.account_code,
L.account_description,
MH.account_main_head_description,
SUM(P.amount) total_amount
FROM
terminal_master T,
petty_cash_voucher_master P,
ledger_accounts L,
account_main_heads MH
WHERE
T.terminal_id = P.account_to_terminal (+)
AND
L.account_code (+) = P.account_code
AND
MH.account_main_head_code (+) = L.account_main_head_code
AND
P.voucher_date (+) > = '16-jun-05'
AND
P.voucher_date (+) < = '16-jun-05'
GROUP BY
P.currency_code,
T.terminal_town_code,
P.account_code,
L.account_description,
SH.account_main_head_description.
Thanks in advance.

Hi all,
Im reactivating this, still im looking for help, giving here sample data.
Account Main Heads
Account_main_head_code, Main_head_description
01 ADMINSTRATIVE
02 OPERATIONAL
Ledger_codes account_code,account_description,accound_main_head_code
01 SALARIES 01
02 PHONES 01
03 FUEL 02
Terminal_master
Terminal_id,terminal_station_code
1 HYD
2 VJA
3 NY
4 WDC
Petty_cash_voucher voucher_date,terminal_id,currency_code,account_code,amount
30-jun-05 1 GBP 01 100
30-jun-05 2 GBP 01 200
30-jun-05 3 GBP 02 300
30-jun-05 4 GBP 03 250
Im looking for the MATRIX layout as follows :
GBP (first group)
ADMINISTRATIVE (secind group)
.................HYD.....VJA....NY ....WDC
Salaries.........100.....200.....0......0
Phones............0.......0.....300.....0
OPERATIONAL
.................HYD.....VJA....NY....WDC
Fuel..............0.......0.....0.....250
(terminals as columns, ledger description as Rows).
main thing is i need to get all the terminal as it is in any group. i have used ...'s to maintain alignment.
Thanks again.

Similar Messages

  • How can I get this thru SQL ?

    Hi,
    I am having following sample data
    NUMRUB FORMAT
    1 X(02)
    2 9(02)
    3 9(08)
    4 X(20)
    5 9(01)
    6 X(03)
    7 9(1)
    8 X(02)
    9 9(02)
    I want output in following way
    NUMRUB FORMAT NewFormat Start Position
    1 X(02) 2 1
    2 9(02) 2 3
    3 9(08) 8 5
    4 X(20) 20 13
    5 9(09) 9 33
    6 X(03) 3 41
    7 9(1) 1 44
    8 X(02) 2 45
    9 9(02) 2 47
    How can I get this thru SQL ?
    Pl guide me.
    thanks & regards
    PJP

    SQL> create table mytable (numrub,format)
      2  as
      3  select 1, 'X(02)' from dual union all
      4  select 2, '9(02)' from dual union all
      5  select 3, '9(08)' from dual union all
      6  select 4, 'X(20)' from dual union all
      7  select 5, '9(09)' from dual union all
      8  select 6, 'X(03)' from dual union all
      9  select 7, '9(1)' from dual union all
    10  select 8, 'X(02)' from dual union all
    11  select 9, '9(02)' from dual
    12  /
    Tabel is aangemaakt.
    SQL> select numrub
      2       , format
      3       , to_number(regexp_replace(format,'(X|9)\((.*)\)','\2')) "NewFormat"
      4       , nvl
      5         ( sum(to_number(regexp_replace(format,'(X|9)\((.*)\)','\2')))
      6           over (order by numrub rows between unbounded preceding and 1 preceding)
      7         , 0
      8         ) + 1 "Start Position"
      9    from mytable
    10   order by numrub
    11  /
        NUMRUB FORMA  NewFormat Start Position
             1 X(02)          2              1
             2 9(02)          2              3
             3 9(08)          8              5
             4 X(20)         20             13
             5 9(09)          9             33
             6 X(03)          3             42
             7 9(1)           1             45
             8 X(02)          2             46
             9 9(02)          2             48
    9 rijen zijn geselecteerd.Regards,
    Rob.

  • [SQL] how can i get this result....??(accumulation distinct count)

    [SQL] how can i get this result....??(accumulation distinct count)
    Hi everybody,
    pls tell me how can it possible to get result?
    ### sample data
    date visitor
    10-01 A
    10-01 A
    10-01 B
    10-01 B
    10-01 C
    10-01 C
    10-02 A
    10-02 C
    10-02 C
    10-02 D
    10-02 D
    10-03 B
    10-03 B
    10-03 B
    10-03 A
    10-03 A
    10-03 F
    10-04 A
    10-04 A
    10-04 F
    result that i want...like this.
    date date_unqiue_visitors acc_date_unique_visitors
    10-01 3 3
    10-02 3 4
    10-03 3 5
    10-04 2 5
    date distinct visitors : count(distinct visitor)
    but how can i get accumulation distinct visitor count???
    Thanks to every body..

    SQL> select dt,cnt,sum(cnt1) over(order by dt) cnt1
      2  from(
      3  select dt,count(distinct visitor) cnt,sum(flg) cnt1
      4  from
      5   (select dt,visitor,(select decode(count(*),0,1,0)
      6                           from test
      7                           where rowid < t.rowid
      8                           and visitor = t.visitor) flg
      9   from test t)
    10  group by dt);
    DT                CNT       CNT1
    10-01               3          3
    10-02               3          4
    10-03               3          5
    10-04               2          5
    Message was edited by:
            jeneesh
    Wrong...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • TS3989 My 5th gen ipod touch was stolen.  I removed the device from my iTunes account, but their pictures still show up on the photostream on the one I purchased to replace it.  How do I get this to stop, the cops have no interest in their faces, nor do I

    My 5th gen iPod touh was stolen a month ago.  I immediately removed that device from my account and yet today I looked at my photostream and there are tons of pics of these people on my photostream.  How do I get this to stop?!?

    Change your iCloud ID password: http://support.apple.com/kb/HT5624.  After doing so, go to Settings>iCloud, tap Delete Account, then sign back in with the new password.

  • HT1688 I used a MC $50 Giftcard for the iTunes one day. It was supposed to update the games, and other apps on my phone. Only, it wouldn't go through, the credit card was declined. Still, I was charged 4 times. How do I get this back??

    To Whom It May Concern:
    I bought a Mastercard Giftcard for $50 the other day. It was only because the games needed updating before I could play them again, and my card on file had expired.
    I kept getting a message stating the the card was declined. Also, it kept telling me to try to put in another card, or different form of payment.
    I tried several times to get the MC to go through, and it didn't. It was not even showing that the card info even updated!
    When I went to check the amount of the giftcard, there were 4 pending charges of $10.89 on it.
    How do I get this money back? Please let me know as soon as possible.
    Sincerely,
    Queenie from Texas

    I did but that was from a month before, I want pics I took after that backup time. It deleted without my consent like this is not cool. I had recent pics from my trip.

  • Adobe CR 6.7 does not install into CS5, how can I get this installed to view CR files?

    Just installed CS5 onto new computer. Adobe bridge and CS5 do not recognize CR format. How can I get this installed. I have tried up dating and downloading the CR6.7 update, but can not get it to install. What do I do?

    Product updates

  • HT4356 My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    hi
    could you tell us what the other app is please

  • I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    Follow the instructions under the heading "How to unlink a phone number" on this page.

  • Hello, I want to restore a backup on my Iphone 4S, but in i-tunes it's not vissable. When I'll look on te pc: (username)\Application Data\Apple Computer\MobileSync\Backup\ it's there! How can I get this backup to my iphone or itunes? Thanks in advance!

    Hello, I want to restore a backup from this afternoobut in i-tunes it is not visseble. When I'll look on te pc: (username)\Application Data\Apple Computer\MobileSync\Backup\ it's there! How can I get this backup to my iphone or itunes? Thanks in advance!

    Follow the steps in this article to restore from iTunes back up:
    http://support.apple.com/kb/HT1766
    Since you say you cant see the back up in iTunes you should be able to see it when following the last step where it says for iTunes 10.7 or earlier. Dont worry as this step also works for iTunes 11.

  • TS1702 My cars 2 app mate app is not working after upgrading from ipad to ipad 2...... synced.... uninstalled and re installed several times as well as wiped ne ipad out and re did the whole proccess several times. how can I get this app working?

    I have installed the cars 2 app mate on a ipad 2 from an ipad 1 synced with itunes account.. all is working except this app. After many times of un installing and re installing aswell as talking to apple tech suport this app is still not working.... its there it just has no function...... how can i get this installed and working, my grandson is autistic and uses this app many hours a day........ it is important for me to get this up and running again for him.......

    (1) So, I found a youtube video showing how to open up my iMac and replace a Disk drive. I opened it. I removed the disk drive. I opened the metal cover of the lid of the disk drive. It was clean and immaculate; so, it destroyed and debunked the dirty drive theory. But, just to make sure I sucked around the optical sensor with a vacuum and gently brushed it with a Q-tip.
    (2) I then watched a you tube video showing how the drive operated (it was a drive supplied with power outside an iMac with a transparent cover unlike the opaque metal cover that we have on our drives). My scientific curiosity started to wonder if somehow the mechanical part (of the electro-mechanical assembly) was locked or jammed. So, I started messing with the arms with the utmost care after watching the video to see if i could move them manually. Yes on some. The main arm that is linked with the drive motor was immovable. The rest I played with a little bit, took great notice in the start of the video to see how the arms looked before inserting a disk. I then put it all back together.
    It works now. My guess is that taking it out and then placing it back in along with the resetting options that others have done was the trick. I believe it is a possibility that the hard drive became locked mechanically in some strange manner after ejecting a DVD in conjunction with the uploading of the new OS. I believe the actual removal, reinstallation, and resetting of the drive put everything back into sync. My computer sits in a climate controlled dust free environment. I knew for a fact that this hard drive was OKAY.

  • My computer crashed and my itunes library only has my purchases which is 645 songs instead none of my play lists.  my 60g ipod has 1145 songs and all my playlists.  how do i get this content back to my itunes program

    my computer crashed and i had to reinstall intunes.  i have 1144 songs plus some playlists on my old 60g ipod.  my itunes library on my computer only has the songs that i purchased from itunes and none of playlists.  how do i get this content form my ipod back onto my itunes program on my computer.

    check out this post by Zevoneer.

  • My iPod Classic is seen by Windows but not by iTunes.  I have reset it, gone to disk mode and it won't show up in iTunes.  There appears to be music on it in a file called MUSICSAVE.  How can I get this to work with iTunes again?

    My iPod Classic is seen by Windows but not by iTunes.  I have reset it, gone to disk mode and it won't show up in iTunes.  There appears to be music on it in a file called MUSICSAVE.  How can I get this to work with iTunes again?

    1. Update iTunes to the latest version. Plug in your iPod. If iTunes still can't recognize it, then in iTunes in the top left corner click help> run diagnostics. On the box that comes up, check the last two things. Click next and it should identify your iPod.
    2. Click on your windows start menu. Type in "services". Click on it and when it pops up, on the bottom of it click on "standard". Now Scroll down to find "Apple Mobile Device" Right click it when you see it and click on "Start". When it has started, close iTunes and replug in your iPod and it should show up.
    3. Check the USB cable
    4 Verify that Apple Mobile Device Support is installed
    5. Restart the Apple Mobile Device Service and verify that the Apple Mobile Device USB Driver is installed.
    6. If you just want to add some photos, songs and movies from computer to your devices, you can use an iTunes alternative to do the job
    7. Check for third-party software conflicts.
    <Link Edited By Host>

  • When I move my curser over certain things I get this Message in a window that pops up and says "We noticed you may have signed in or signed out in another window click ok to reload your page." How do I get this to stop.

    When I move my curser over certain things I get this Message in a window that pops up and says "We noticed you may have signed in or signed out in another window click ok to reload your page." How do I get this to stop.

    Clear the cache and the cookies from sites that cause problems.
    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    You may have to create an Allow cookie exception for that server.
    * Tools > Page Info > Permissions

  • I can't open a file on Pages'09 4.1    I get  window that says "The required index.xml file is missing."  How do I get this file open?

    I have a file that I havel been adding to for years. I opened it a week ago but today I tried and I got the window message
    "the required index.xml file is missing"  How do I get this to open?
    I have Pages '09  4.1  Not sure when that was put on or updated.
    Thanks for any help you can give
    Teacher72

    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=308&mforum=iworktips ntrick
    Are you sure you haven't upgraded Pages on your Mac to Pages 5?
    Check your Applications folder and the Applications/iWork folder. You may have 2 versions on your Mac.
    Peter

  • How do I get this beta IOS 7.0.2 JUNK TO WORK with my iPod touch 5???

    How do I get this beta IOS 7.0.2 JUNK TO WORK with my iPod touch 5?? I was prefectly happy with my iPod until I got the notice to upgrade itunes to 11.1 and would you like to upgrade your iPod from IOS 6 to IOS 7. And like an idiot I took the little green pill and pushed the button. Now I can't open iTunes, some apps; like the Lindsey Sterling app, Safari and Disney don't work either (not that I care about the Disney one, but, it's part of the base setup, you'd think "IT" would work!) almost anything with video links will not open, iCloud can't find me. All I get is that annoying white screen. I'M NOT HAPPY! I could have bought a Windows machine for a lot less money and have the same problems!?! (I'll bet Mr. Jobs is spinning like a top right now!)  And I have goggled-- found a few fixes: re-install, restore, etc. found one that stated to get iTunes back to go into the iPods setting by double ckicking the home button go to iTunes app and sign out, then sign in again-- those options didn't work. JEM24

    If you restored to factory settings/new iPod via iTunes (Not via Settings>General>Reset>Erase all Content and Setting) and still have the problem that indicates a hardware problem.
    Make an appointment at the Genius Bar of an Apple store..
      Apple Retail Store - Genius Bar

Maybe you are looking for

  • Adobe Pro 9

    Hi I had to reformat my PC. Trying to update my Adobe Pro 9 now but I am unable to find the very first update, 9.1. Adobe - Acrobat 9 Pro Extended : For Windows Can a fellow Adobe Pro user help me with this one ? Flyingfsih551

  • Installing 10g Enterprise/Standard on windows 7(home basic/ultimate)

    Hi, I hv problem during installation 10g on windows 7, i hv installed it with win xp sp2 mode, but it shows warning msg regarding permission javaw.exe, i hv given all those permission, the installation proceed, but at the end it gives error msg somet

  • Manual for the touchpad

    Hi... I just got one of these HP touchpad 16 gb but I have no clue how to use it . Can someone point me in the right direction for the manual and if their is a How To in using it . Also any pointer that I need to know . thanks Post relates to: HP Tou

  • Problem in screen whilw calling it from report

    Hi friends, I have created a report which contains a selection screen with following fields. Selection screen all are slect optins. VBELN KUNNR MATNR now when i enter the values in these slection screen and execute it, it basically calls a screen 100

  • Is it possible to get a black background when using Picture Book layout in iphoto?

    I want to customize the layouts more in iphoto--either be able to use a black background when using the Picture Book layout, or have more layout options in the Photo Essay layout.  Are either of these possible? Thanks!