Return 0 for months with title which doesn't contain any transaction

SELECT decode(c.ORGANIZATION_CODE,'MP','Main Plant','MP2','Sub Plant','NA') Organization,a.ORGANIZATION_ID ,A.INVENTORY_ITEM_ID,b.DESCRIPTION,
TO_CHAR(A.TRANSACTION_DATE,'MON') MONTHH,ROUND(ABS(SUM(A.TRANSACTION_QUANTITY)),2) TRAN_QTY
FROM MTL_MATERIAL_TRANSACTIONS A,mtl_system_items b,mtl_parameters c
WHERE A.TRANSACTION_TYPE_ID=35
AND A.INVENTORY_ITEM_ID IN (12041,12043,12037,12039,12046)
and a.INVENTORY_ITEM_ID=b.INVENTORY_ITEM_ID
and a.ORGANIZATION_ID=b.ORGANIZATION_ID
and a.ORGANIZATION_ID=c.ORGANIZATION_ID
GROUP BY c.ORGANIZATION_CODE, A.ORGANIZATION_ID,A.INVENTORY_ITEM_ID,b.DESCRIPTION, TO_CHAR(A.TRANSACTION_DATE,'MON')
ORDER BY TO_DATE(MONTHH,'MON')
Above query return Data of Jan,Feb, Mar, Apr,May,Jun because we have only opened six months. i want to show all months upto DEC even not opened with 0 value.
e.g
Jan 100
Feb 200
mar 330
apr 150
may 140
jun 125
july 0
aug 0
sep 0
Dec 0

Maybe something like this:
SQL> set feedback on
SQL> WITH test_tab AS (SELECT   'Jan 2009' month_name, 100 amount FROM DUAL
  2                    UNION ALL
  3                    SELECT   'Feb 2009', 200 FROM DUAL
  4                    UNION ALL
  5                    SELECT   'Mar 2009', 330 FROM DUAL
  6                    UNION ALL
  7                    SELECT   'apr 2009', 150 FROM DUAL
  8                    UNION ALL
  9                    SELECT   'may 2009', 140 FROM DUAL
10                    UNION ALL
11                    SELECT   'jun 2009', 125 FROM DUAL)
12  -- end of test_data
13  SELECT   *
14    FROM   TEST_TAB
15  /
MONTH_NA     AMOUNT
Jan 2009        100
Feb 2009        200
Mar 2009        330
apr 2009        150
may 2009        140
jun 2009        125
6 rows selected.
SQL> WITH test_tab AS (SELECT   'Jan 2009' month_name, 100 amount FROM DUAL
  2                    UNION ALL
  3                    SELECT   'Feb 2009', 200 FROM DUAL
  4                    UNION ALL
  5                    SELECT   'Mar 2009', 330 FROM DUAL
  6                    UNION ALL
  7                    SELECT   'apr 2009', 150 FROM DUAL
  8                    UNION ALL
  9                    SELECT   'may 2009', 140 FROM DUAL
10                    UNION ALL
11                    SELECT   'jun 2009', 125 FROM DUAL)
12                    -- end of test_data
13    SELECT   TO_CHAR (b1.derived_months, 'MON') month_name,
14             NVL (amount, 0) amount
15      FROM   test_tab a1,
16             (    SELECT   ADD_MONTHS (TRUNC (SYSDATE, 'YYYY'), LEVEL - 1)
17                              derived_months
18                    FROM   DUAL
19              CONNECT BY   LEVEL <= 12) b1
20     WHERE   UPPER (a1.month_name(+)) = TO_CHAR (b1.derived_months, 'MON YYYY
21  ORDER BY   b1.derived_months
22  /
MONTH_NAME       AMOUNT
JAN                 100
FEB                 200
MAR                 330
APR                 150
MAY                 140
JUN                 125
JUL                   0
AUG                   0
SEP                   0
OCT                   0
NOV                   0
MONTH_NAME       AMOUNT
DEC                   0
12 rows selected.
SQL>Regards,
Jo

Similar Messages

  • When I try to send an email I get the message rejected by the server because it does not allow relaying.  I have sent mails for months with no problems. Can anyone help

    When I try to send an email I get the message rejected by the server because it does not allow relaying.  I have sent mails for months with no problems but has started to be recoccuring. Can anyone help please as its pointless having email on my phone otherwise :-(  as i have to wait till i log on at home to respond.
    thanks
    Alison

    https://discussions.apple.com/message/16832350#16832350  follow the link user was having same problem.  Solution was given.

  • Hello, since I actualized my Mac with Maverick it doesn't recognize any  external hard disk ,... only the one to make copy on the time machine. Can anybody help me? thank you!!!!

    hello, since I actualized my Mac with Maverick it doesn't recognize any  external hard disk ,... only the one to make copy on the time machine. Can anybody help me? thank you!!!!

    Hello Laurabcn,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    USB and FireWire Quick Assist
    http://support.apple.com/kb/ht1151
    Have a nice day,
    Mario

  • Display items which doesn't  have any posting data in report painter

    I made some reports by report painter. The problem is that when I run these reports, they can't display the items which doesn't have any posting data. But my customers want to display all items whatever it has been posted or not , can you give me the solution?
    BTW, when I made Reports by using Drilldown report, it  display all items
    Thanks and best regards!

    In the change report screen in GRR2 go to menu
    Formating--> report layout
    There in the rows tab select the radio button, Print Zero rows
    and in the columns tab select Print Zero columns radio button,
    hope this should solve the problem
    Thanks
    Naveen

  • OIM-How can i set a password policy which does not contain any space?

    How can i set a password policy which does not contain any space?
    I put space at Characters not allowed but it is not working.
    Can anyone help me out?

    You can go to Settings>Messages and turn off Messages. Then go to Settings>General>Restrictions and turn on the the Restriction that prevent changing accounts.
    I just verified that it works.

  • DataSocket JavaBean doesn't contain any beans. Why not?

    I can't get my DataSocket JavaBean to install in my Java application. I can't find any classes and I try loading it into a Java BeanBox and it gives me the error that it doesn't contain any beans. Anyone know how to fix this or what I'm doing wrong? I need to be able to communicate between a Java Application and LabVIEW RT.

    have you tried to import the whole class inot your bean application?

  • Adobe Bridge shuts down when I try to access files on my external drive. Have been using the drive for months with no problems.

    Adobe Bridge shuts down when I try to access files on my external drive. Have been using the drive for several months with no problems.

    Due to the current unavailability of clairvoyants and mind-readers in the forum, we respectfully request you supply sensible, complete details.
    A lot more information about your hardware and software is needed.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CC", but something like CC2014.v.2.2) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    a screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • I got a NEW problem with Facebook - which doesn't accept now to open because Moz-Firefox [prefered & usual navigator] parameters "wouldn't accept cookies" ! BUT, the parameting is OK - it SHOULD work ! I DO NOT know what to do with [?!?] Tks.

    1. Message from Facebook →
    « Cookies nécessaires >>>
    Votre navigateur internet n'accepte pas les cookies. Vous devez modifier cette option dans vos paramètres de sécurité avant de continuer. »
    2. My parameting →
    « Accepter les cookies > Yes
    Accepter les cookies tiers > Yes too
    Conserver > Jusqu'à leur expiration »
    3. That was Ok before - don't know what happended - IMPOSSIBLE to repair.
    Thanks for helping with my favorite navigator !
    Ifanelix

    Please review the information found on this web page: [https://support.mozilla.com/en-US/kb/Options+window+-+Privacy+panel?s=Privacy+Options&as=s#Use_custom_settings_for_history Setting Firefox to Accept Cookies]
    Please make sure to check the following options:
    1. Accept cookies from sites
    2. Accept third-party cookies

  • Problems with smart collection "doesn't contain"

    I have photos with keywords like
    xxxxx, grand canyon,xxxxx
    xxxxx, grand island, xxxxx
    xxxxx, grand sable dunes, xxxxx
    What I need is the abilty creat a smart collection that excludes grand canyon, but leaves in grand island, grand sable dunes
    I can't get doesn't contain to work with
    grand canyon
    "grand canyon"
    Any ideas?

    Tudor asks, "What I need is the ability to create a smart collection that excludes grand canyon, but leaves in grand island, grand sable dunes".   Tudor wants to exclude "grand canyon", but include "grand island", "grand sable dunes", "red rock canyon", and presumably every other keyword except "grand canyon".
    BKKDon's suggestion of
    Match all: Keywords contains grand; Keywords doesn't contain canyon
    doesn't quite work, because it excludes "red rock canyon".   A somewhat better query might be:
    Match none: Keywords contains words grand canyon
    The "contains words grand canyon" will match all images with the words "grand" and "canyon" in the keywords, and "Match none" inverts that and selects all other images.  
    But this still isn't right, because it will exclude an image having the two keywords, "Grand Island" and "Canyon Drive".  As Rob explained, the Keywords criterion splits all the keywords up into "words", and then treats all the words in all the image's keywords as a single field to be searched.
    Two possible workarounds:
    - If you just want to manually exclude images with the keyword "grand canyon", use this recipe: 
    In the Keyword List pane on the right, click the arrow to the right of the keyword "grand canyon".  This will filter just those images with exactly "grand canyon". 
    Select all the images.
    Turn off the filter by clicking None in the Library Filter bar.
    Do Edit > Invert Selection to select all the images that don't have exactly "grand canyon".
    Add the selected images to the Quick Collection or another collection, if necessary.
    - Use the plugins Space Urchin or Any Filter, as Rob suggested.
    In general, LR's text-matching operators are a mess.  Inexplicably, LR doesn't have exact match, the most basic keyword operator, and without exact match, it's difficult to work with a controlled vocabulary of keywords, as this discussion and many others have highlighted.  Users repeatedly get all twisted up trying to understand how to use LR's weird text-match operators.

  • 1099 Misc reporting for US in SAP Standard report not containing any value

    HI All,
    In my current clients requirement is to get the SAP Standard reprort for 1099 Misc reporting for US
    1) Accordingly i have done configuration for Withholding tax for US with tax type FE
    2) There are 14 WHT Tax codes under FE , like 01 = Rent , 02 = royalty, 03 = other income etc.
    3) Assigned Tax type  with Co. Code
    4) Activated WHT tax at Co. code
    5) Created WHT country US
    And also assign WHT tax type FE and respective tax code to vendors in Accounting info in Vendor Master
    Posted couple of vendor invoices and made payment for those also
    Then after this when i run the SAP Standard report for 1099 Misc reporting for US , then the output contains with no data..  but only contains vedor names and WHT tax code which i have assigned..
    I think i have missed some configuration may be . Can any one let me know the detail step by step config and process how to get proper out put in 1099 Misc reporting for US in Standard reporting..
    Regards,
    Sandip

    Hello auroar,
    I followed the path that you provided and that lead me to this part of the tree: Define File Format for Withholding Tax Reporting...This is where I found the information that I needed.
    Thank you very much.
    -Patrick
    Edited by: Patrick Smith on Oct 22, 2009 8:41 PM

  • Stored Procedure for Blocking from using a Specific Warehouse in any transaction

    Hi,
    Is it possible to write a SP from using a Specific Warehouse in any transaction ?

    Hi,
    Try this SP for sales order. Change 01 to your warehouse code
    IF @transaction_type in ('A','U') AND (@OBJECT_TYPE='17')
    BEGIN
    IF  exists (SELECT t1.docentry  FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry  WHERE T1.[WhsCode] = '01'  and
    t0.docentry =  @list_of_cols_val_tab_del )
    Begin
    SET @error = 123
    SET @error_message = 'Check warehouse code'
    End
    End
    Thanks & Regards,
    Nagarajan

  • MIGO - PO doesn't contain any items

    Dear Gurus,
    Did the stocktransfer through sd route from one plant to another depo, then did the replenishment delivery through VL10B, then did the proforma invoice and then the excise invoice, then we've also observed the stock in MB5T falling in stock -in-transit.
    Now while doing MIGO , given the Po no  and pressed enter it says PO doen't contain any items. the items are not copied from PO to Migo, it give the above message. please suggest
    When i did the same scenario in development evrthing was through. this problem occurs in production
    Please advise

    Dear,
    Please check Purchase Order.
    Enter t-code ME23N.
    Enter your purchase order. Go Item level in Confirmation tab available in purchase order item detail level.
    Check in Confirmation Control Key"Tracking: Import" is exists.
    If yes than remove it from ME22N and save purchase order than try for MIGO.
    NOTE: - Check it each item wise for purchase order.
    Regards,
    Mahesh.
    Edited by: Mahesh Wagh on Aug 13, 2008 4:23 PM

  • For syncing with IE, which is better, PlainOldFavorites or Xmarks?

    I'm looking for a solution that will update my FF bookmarks with changes to my IE bookmarks, and vice versa. I rarely use IE, but some websites work with it and not FF. I don't want a solution that requires me to copy all my bookmarks to IE favorites, or vice versa. Seems like that way loses new bookmarks on either end, the one copied to. I just want a simple cross-platform sync.

    PlainOld Favorites doesn't "synchronize", it uses IE Favorites from their default location in AppData and Firefox Bookmarks remain separate.

  • Return delivery for imports with duty

    Dear all,
    I have recieved goods from imports vendor and paid the duty taken credit . I want to return the goods back to the vendor
    What's the procedure coz it involves duties.
    Is ARE1 anywhere related.

    Hi,
    Yes, follow Export sales process to return the material and also you have to create ARE1 document for the same.

  • Help with Youtubevideo which doesn't work in internetexplorer

    Hi there,
    I'd tried to implement a youtube video  guided by this :  http://www.heathrowe.com/adobe-edge-preview-4-append-youtube-video/
    It worked fine  in firefox and chrome  but  it doesn't work in internetexplorer :-(
    Is there a way to modify the code so it would work in all browsers?
    I also tried a hint via google  to change the codepart   .....      $("<iframe type='text/html'     .....     to   ....    $("<iframe type='application/x-shockwave-flash'
    but it didn't work either...so I'm stuck now
    Thanks for your help
    Greetings
    martin

    Thanks Schrene,
    strange...i opened it online from my notebook in IE  and it worked...but my workstation has the same IE Version  9.0822  etc.. and it does not work from there...
    well...anway... basicly  it works :-)
    thx :-)
    Martin

Maybe you are looking for