Group query do not give the desired results

Hello
I have a requirement minimum months based on the State to find:
The following query is in error:
SELECT
b.APP_NAME,
DECODE (a.status,
'C', 'closed ',.
'O', 'open ',.
'F', 'Future',
"W", "pending."
', 'Not open') decode_status
MIN (a.period_name)
TABLE,.
table b
WHERE a.app_id = b.app_id
AND b.app_name = 'name1 '.
A.book_id = & book_id
AND a.status = 'o'
B.app_name GROUP,
DECODE (a.status,
'C', 'closed ',.
'O', 'open ',.
'F', 'Future',
"W", "pending."
', 'Not open') decode_status

for ex: in the above query if I have four records with the status 'o' and period_name ' may-12', ' Jun-12', ' Jun-12', ' Aug-12', then I need to choose 'may "".

Thank you
Kiran

Maybe

SELECT b.app_name,
       DECODE (a.status,'C','Closed','O','Open','F','Future','W','Pending','N','Not Opened') decode_status
       MIN(to_char(to_date(a.period_name,'Mon-RR'),'RRMM')) period_num
  FROM table a,
       table b
 WHERE a.app_id = b.app_id
   AND b.app_name = 'NAME1'
   AND a.book_id = :book_id
   AND a.status = 'O'
 GROUP BY b.app_name,DECODE(a.status,'C','Closed','O','Open','F','Future','W','Pending','N','Not Opened')

Concerning

Etbin

Tags: Database

Similar Questions

  • Why "bgp bestpath missing-as-worst med" command does not produce the desired result?

    Can dear all, someone tell me why "bgp bestpath missing-as-worst med" command does not produce the desired result?
    And I use GNS3 to this practice, the IOS Version: 12.4 (3)
    TKS...

    Back to the beginning:
    192.168.23.0/24 192.168.12.0/24
    RA(F0/0)-(f0/0) RB (s2/0) - RC (s2/0)
    [AS1]                    [AS2]                    [AS3]

    Configuration:
    * RA *:
    A #do sh run (config - router). b r b
    router bgp 1
    no synchronization
    The log-neighbor BGP-changes
    1.1.1.0 netmask 255.255.255.0
    192.168.12.2 neighbor remote-2
    setmed map of nearby route 192.168.12.2 out
    No Auto-resume

    IP route 1.1.1.0 255.255.255.0 Null0

    setmed allowed 10 route map
    the metric value 20

    * RB *:
    B (config - router) #do sh run | b r b
    router bgp 2
    no synchronization
    BGP always-compare-med
    The log-neighbor BGP-changes
    BGP bestpath missing-as-worst med
    neighbor 192.168.12.1 distance-1
    neighbour 192.168.23.3 distance-3
    No Auto-resume

    * RC *:
    C (config - router) #do sh run | b r b
    router bgp 3
    no synchronization
    The log-neighbor BGP-changes
    1.1.1.0 netmask 255.255.255.0
    neighbour 192.168.23.2 distance-2
    No Auto-resume

    IP route 1.1.1.0 255.255.255.0 Null0

    But when I checked out table RB bgp, as below:

    B (config - router) #do sh ip bgp
    BGP table version is 2, local router ID is 192.168.23.2
    Status codes: deleted, cushioning d s, history of h, * valid, > best, i - internal.
    r SIDE-failure, stale S
    Source codes: i - IGP, e - EGP,? -incomplete
    Network Next Hop path metrics LocPrf weight
    * > 1.1.1.0/24 192.168.23.3 0 0 3 I
    *                          192.168.12.1            20                         0  1 i

    The prefix is assigned a MED of 0, but also the best path value when I use "bgp bestpath missing-as-worst med" in how to configure bgp... :-(

    Please take a look at the discussion on the configuration of drugs to an eBGP neighbor:

    https://supportforums.Cisco.com/thread/343397?TSTART=0

    Note that BGP MED is set to 0 even if the injected BGP route from a connected route.

    The first time I came across this problem sending MED was there in a picture of 5-6 years service provider. Routes were injected into BGP with the command 'network', has been validated by OSPF routes or static to null0. Involuntary consignment of drugs was mess with load balancing between 2 links of our inbound traffic from the same upstream service provider.

    Also note that if a route is learned via iBGP, border router removes MED before the road to advertising for an eBGP peers (i.e. the above comments apply a when a route is injected locally into the border and then router BGP sent to an eBGP peer).

    I don't know what the cause of the problem that you said in your last post. It delivers last for a long time or that it does not change after a while?

    p.s. Sorry, I edited post because I said "iBGP" instead of "eBGP" at some point.

  • Query not showing the desired result

    Hi all

    DB:-10.2.0.3

    I use the backuppice, which is located between the dates specified by the query after query to extarct. I am really surprised, why it is not giving me the expected results.
    select handle, to_char(start_time, 'dd-mon-yy hh24:mi:ss') "start_time" , to_char(completion_time, ' dd-mon-yy hh24:mi:ss') "end_time" from
    v$backup_piece where 
    to_char(start_time,'dd-mon-yy hh24:mi:ss') >'27-oct-10 23:00:00' 
    and 
    to_char(completion_time,'dd-mon-yy hh24:mi:ss')<'28-oct-10 04:20:53'
    
    Results truncated, just to fit in this window.
    
    23:02:25
    /data/oracle/LNEVRPP1/backup/database/c-465769364-20100927-0c                         27-sep-10 23:02:39           27-sep-10 
    23:02:40
    /data/oracle/LNEVRPP1/backup/database/LNEVRPP1_ctl_l1_t730854174_s32554_p1.rmn        27-sep-10 23:02:58           27-sep-10 
    23:02:59
    /data/oracle/LNEVRPP1/backup/database/c-465769364-20100927-0d                         27-sep-10 23:03:02           27-sep-10 
    23:03:02
    /data/oracle/LNEVRPP1/backup/database/LNEVRPP1_arc_l1_t730854220_s32556_p1.rmn        27-sep-10 23:03:41           27-sep-10 
    23:03:44
    /data/oracle/LNEVRPP1/backup/database/c-465769364-20100927-0e                         27-sep-10 23:03:51           27-sep-10 
    23:03:51
    /data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733532449_s33531_p1.rmn        27-oct-10 23:00:50           27-oct-10 
    23:36:00
    /data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733534566_s33532_p1.rmn        27-oct-10 23:36:07           27-oct-10 
    23:48:38
    
    HANDLE                                                                                start_time                  end_time
    ------------------------------------------------------------------------------------- --------------------------- -----------
    -----------------
    /data/oracle/LNEVRPP1/backup/arc2adsm/LNEVRPP1_arc_l0_t733536053_s33534_p1.rmn        28-oct-10 00:00:54           28-oct-10 
    00:01:13
    /data/oracle/LNEVRPP1/backup/database/c-465769364-20101028-00                         28-oct-10 00:01:22           28-oct-10 
    00:01:23
    /data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733535322_s33533_p1.rmn        27-oct-10 23:48:43           28-oct-10 
    00:20:06
    /data/oracle/LNEVRPP1/backup/database/LNEVRPP1_dbf_l0_t733537209_s33536_p1.rmn        28-oct-10 00:20:10           28-oct-10 
    00:33:44
    /data/oracle/LNEVRPP1/backup/database/c-465769364-20101028-01                         28-oct-10 00:33:47           28-oct-10 
    00:33:48
    /data/oracle/LNEVRPP1/backup/database/LNEVRPP1_ctl_l0_t733538041_s33538_p1.rmn        28-oct-10 00:34:04           28-oct-10 
    00:34:04
    /data/oracle/LNEVRPP1/backup/database/c-465769364-20101028-02                         28-oct-10 00:34:06           28-oct-10 
    00:34:07

    Hello

    Try:
    handle Select to_char (start_time, 'dd-mon-yy hh24:mi:ss') 'start_time', to_char (completion_time, 'dd-mon-yy hh24:mi:ss'), 'end_time '.
    v $ element_sauvegarde
    where start_time > to_date (27 October 10 23:00 "," dd-mon-yy hh24:mi:ss'")
    and completion_time< to_date="" ('28-oct-10="" 23:00:00','dd-mon-yy="">
    /

    Kind regards

    Tycho

  • outer join does not give the expected results (missing documents)

    Hello
    I have problem with outer join in OBIEE 10 g.

    I'm testing it on the model of simplified database

    STAT table with some statistics of TYPEs
    stat_date, id_type, num
    ..
    ..
    26/03/2003, 20: 1
    26/03/2003, 21: 1
    26/03/2003, 23: 1
    26/03/2003, 24, 1
    26/03/2003, 25, 1
    ..
    27/03/2003, 22, 1 <-different date here
    ..
    ..

    Table TYPES
    ID_type
    ..
    ..
    20
    21
    22
    23
    24
    25
    ..
    ..


    Physical model
    STAT >-TYPES


    AM.
    F1 (only Digital STAT table column (agg. County))
    D1 (STAT_DATE of the STAT table column only)
    D2 (source TYPES)

    D1 - inner join - < F1
    D2 - left outer join - < F1


    I would like to create simple report filtered by date with number of each type.
    I want to get this result
    ID_type County
    ..     ..
    ..     ..
    20 1
    21 1
    22 null
    23 1
    24 1
    25 1
    ..     ..
    ..     ..


    But I get this
    ID_type County
    ..     ..
    ..     ..
    20 1
    21 1
    23 1
    24 1
    25 1
    ..     ..
    ..     ..

    ID_type 22 is missing


    !!!

    I NORMALLY GET RESULT ONLY IF I DELETE RECORD ' 27/03/2003 22' OF MY FACT TABLE.

    !!!


    I have the filter on the date column D1
    STAT_DATE = 26/03/2003 or STAT_DATE is null


    BI Server running this SQL query


    Select distinct D1.c1 as c1,
    D1. C2 C2
    Of
    (select count (T17840. NUM) in c1.
    T17867.ID_TYPE C2
    Of
    Left outer join of TYPES T17867
    STAT T17840 on T17840.ID_TYPE = T17867.ID_TYPE
    where (T17840. STAT_DATE in (TO_DATE ('2003-03-26', 'YYYY-MM-DD')) or T17840. STAT_DATE is null)
    T17867.ID_TYPE group
    ) D1


    Can you give me some advice?

    Thank you

    Hi cardel,

    I think that you can achieve your goal if you build a dimension of the array STAT form, you can create a table Alias in the physical layer and then to join the table of facts (external to the left). In this way, I think that you can solve your problem.

    Let me know.

    Kind regards
    Gianluca

  • Why is my zero-order hold to not give the expected result?

    I'm trying to reproduce the functionality of the function of the command discrete so that I can use it without having to have a ' loop control and Simulation ".» The attachment desiredresult.vi shows an example of the function to hold discreet order inside the ' loop control and Simulation ".» The other attachment (zeroorderholdquestion.vi) shows my attempt to achieve the same result. I multiplied all index of the loop of the sampling period for the index table for the output y resampled. I have this based on my understanding of the scheme of discrete command waiting given under http://zone.ni.com/reference/en-XX/help/371894G-01/lvsim/sim_dzoh/#details.

    However, I have difficulties to get the frequency of the wave before and after resampling to match to the top. (See attachment for more clarity on what I mean by that). Any suggestions on what I am doing wrong?

    Here, I wrote something similar perhaps to simulate a multi channel, mux, taste and will hold with crosstalk

    http://forums.NI.com/T5/LabVIEW/how-can-I-create-and-sample-and-hold-circuit-in-LabVIEW/m-p/2407256#...

    If time samplerate and hold have a clean report you just need help vi

    Another simple version:

  • How to fix: after upgrade to 31.1, using the list of group name does not, gives the messages this name "is not a valid email address."

    Before the upgrade, I often type in the group alias in the address box, and fills the name of the group. But now when I try to send the message, I get an error that the name that appears "is not a valid email address" and then details how to train the appropriate addresses.

    I deleted the list of my address book personal and recreated to address in my CAP, but the error persists. I have to manually add individual addresses.

    I tried selecting the group from the list in the Contacts pane instead of typing the alias, no change.

    I'm doing something wrong?

    -Mike

    I have new information on this subject.

    It looks like this bug. If you have a Bugzilla account, it would be useful to vote for this issue.

    It seems that lists with a description that includes several words have this problem. The bug report suggests to replace whites "" between the words in the descriptions of these lists with an underscore "_".

    If you don't want to change your descriptions, the other workaround provided still works.

  • Confirmation of dashboard does not display the desired results

    Hello

    I have confirmation created using this condition. But it does not show me the results. The code seems to be correct.any help please...

    -case when TimeStampDiff (SQL_TSI_DAY, "TB1". CL1, CURRENT_DATE) between 0 and 30 or TimeStampDiff (SQL_TSI_DAY, "TB1". Cl2, CURRENT_DATE) between 0 and 30, then 30 days

    When TimeStampDiff (SQL_TSI_DAY, "TB1". CL1, CURRENT_DATE) between 31 and 60 or TimeStampDiff (SQL_TSI_DAY, "TB1". Cl2, CURRENT_DATE) between 31 and 60 then "60 days".

    When TimeStampDiff (SQL_TSI_DAY, "TB1". CL1, CURRENT_DATE) between 61 and 90 or TimeStampDiff (SQL_TSI_DAY, "TB1". CL1, CURRENT_DATE) between 61 and 90 ' last 90 days.

    another end '> 90 and max 100 days '.

    Hello

    Create a dummy column for the code below

    case when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 0 and 30 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL2,CURRENT_DATE) between 0 and 30 then '30 days'
    
    when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 31 and 60 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL2,CURRENT_DATE) between 31 and 60 then ' last 60 days'
    
    when TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 61 and 90 or TimeStampDiff(SQL_TSI_DAY,"TB1".CL1,CURRENT_DATE) between 61 and 90 then 'last 90 days'
    
    else '> 90 and max 100 Days' end
    

    filter as is invited for this column after that giving filter as it is prompting you can hide this column or remove it.

    Save the report

    Award points and to close the debate, if your question is answered.

    See you soon,.
    Aravind

  • Request does not give the same result according to the computer

    Hi all

    My problem is very unclear to me, so I'll try to explain it the best I can...

    So I'm almost finished my project, and I want to try it on another computer.

    In my project, I generate a txt through several file datas, can I use this file to display graphical information on a graph. It works very well.

    So I made a kit of Distribution following this tutorial: http://www.howtocvi.net/2011/12/how-to-make-distribution-kit.html

    I installed the .exe on another computer, and I launched the program.

    My problem is that, for the same data, I used previously, the program is not the same behavior.

    My tracks on the chart do not look like they should be.

    I don't know what are the causes that both programs use the same algorithm...

    If you have an idea, I'll take it!

    Thanks for your answers,

    Kind regards

    Jerome.

    Well, the example was just stressing that debug and release can behave differently, I thought not that it could directly apply to your situation.

    If I were you, I'd start checking the inizialization of the variables, since it is one of the biggest differences between these two scenarios.

    After that, I will add a few DebugPrintf to print relevant during the life of the program variables: DebugPrintf output can be seen in the window Debug Output while developing the program and in utilities like DebugView when running the executable, so you can compare his production in two situations.

    Normally, after some trial and error clarifies the situation and the appropriate corrections can be made to the code.

  • I can not give the password in the Terminal application show the lock icon?

    I can not give the password in the Terminal application show the lock icon? How to Slove this isso please help me? does not accept the password.

    See screenshot below

    Thank you

    You see the key icon is an icon of password to remind you that the password that you type do not appear to echo.

    Try to enter your password and press return on the keyboard.

  • L50 - A - the left end of the space bar satellite do not give the entrance to space

    Everytime I try to press the space bar the left it does not press and do not give the entry space is needed.
    How can I overcome this phenomenon (os Win 8.1)?

    Why do you think this could be a software problem and what part of the software should be responsible for this?

    I guess that's just a keyboard problem.
    You can also check the functionality using external USB keyboard.
    If USB keyboard works properly, the internal keyboard could be affected

    By the way: is updated your BIOS up-to-date?
    If not, try to update the BIOS in the past of the keyboard problems could be resolved with BIOS update.

  • GetDeviceCaps does not give the correct pixel factor in windows 7.

    GetDeviceCaps does not give the correct pixel factor in windows 7, if I use 96 dpi settings means it gives the pixel as 1 factor and if I user the 120 dpi settings means that he must give the factor 1.25 pixel, in windows xp, I had good factor with GetDeviceCaps but in window7, it returns 1 instead of 1.25 pixel factor can someone help me with this problem

    ScreenDPI.x = GetDeviceCaps (ScreenDC, LOGPIXELSX);
    float PixelX = (float) ScreenDPI.x/96;

    Hello

    I would like you to post your question in the TechNet forum.

    http://social.technet.Microsoft.com/forums/en-us/w7itproui/threads

    I hope this helps.

  • its ridiculous... I asked for the plan a month and cloud it recharges on a monthly basis and now when I try to cancel the membership that it does not show the desired option...

    its ridiculous... I asked for the plan a month and cloud it recharges on a monthly basis and now when I try to cancel the membership that it does not show the desired option...

    Cancel your membership creative cloud

    To the link below, click on the still need help? option in the blue box below and choose the option to chat or by phone...
    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If he continues to not try to use a different browser.

    https://helpx.Adobe.com/contact.html?step=CCSN_membership-account-payment_cancel-your-memb ership_stillNeedHelp

  • How can you save your illustration in Photoshop CC 2014 as PNG or JPEG file when it does not give the option?

    How can you save your illustration in Photoshop CC 2014 as PNG or JPEG file when it does not give the option?

    Thank you for your time and help in advance.

    Thanks for the reply. I have actually managed to do work. I had my work instead of 16 or 8-32 bit/channel value. Once I changed it to 16-bit/channel, he gave me the possibility to register under the registered name. Thanks again.

  • OCR does not give the option recognize Portuguese?

    OCR does not give the option recognize Portuguese

    How to solve the problem?

    This is for me:

  • Want 4504: Hp Envy 4504 does not give the impression of color

    Hello

    My Hp Envy 4504 gives color impressions.

    Its keep giving only black & white or gray scale images.

    Also, I couldn't find the printing color profiles or presets under the printer settings.

    I only 'Black and White' and ' black and white - gray ' presets.

    What should I do to get the color print.

    I have two hp color and black ink cartridges installed.

    Help, please.

    Thank you

    Hi @sivak,

    Welcome to the Forums of HP Support!

    I understand that you are unable to print in color on your HP Envy 4504 printer. I will definitely do my best to help you.

    You are able to print a test highlighted report? The printer prints a blank Page or does not black print or ink color for the HP ENVY 4500 and Deskjet Ink Advantage 3540 e-all-in-One Printer Series.

    The problem only occurs when printing from Mac? It seems that there is a problem with the printer driver. Please see these instructions by my colleague Anti-double-U-di.

    Publish:

    10.10 yosemite, foot, make sure you have the latest updates, including Apple updates as well as updates from HP by Apple Software Update (ASU), currently HP printer software update Ver3.0

    Look for the updates (ASU) Apple
    1. click on the Apple in the left menu bar
    2. click on "about this Mac".
    3. click the button of "software updates... »
    4. make sure that the "Updates" icon is selected, click on 'Store' in the top menu
    5. click on 'reload the Page.
    6. install the HP updates (look for the last 'HP Printer Software Update"by the version number)

    Note: If you can't print or scan if he is an all-in-one HP printer, and then follow the steps below.

    Delete the print queue HP printer
    1. click on System Preferences
    2. click on printers & Scanners
    3. click on your printer HP to highlight, then click on the "-" symbol below to remove it from the queue
    4. click on the button "Delete printer" to confirm

    Add the HP printer in the print queue
    1. click on the symbol '+' at the bottom left
    2. If a drop down list with the printers menu appears, just click on "Add printer or Scanner..." »
    3 select your printer HP printer or series (depends USB/Ethernet/WLAN connection type, so choose your HP printer with the correct connection, IE Hello for printers single function and Hello to an MFP multifunction)
    4. after the lower filled, click on the drop down menu to "use:" and select your HP printer series
    5. click on the ' Add ' button.

    Try to print in coiour.

    If the steps above resolved your problem, you don't have to continue troubleshooting.  If you're still having problems, please continue to the next step.

    Before continues, the following steps will remove all printers to printers and Scanners, you may need your software and drivers for the printers to re - install if it is not part of the Apple software updates.

    Reset the printing system:
    1. open System Preferences
    2. open Printers and scanners
    3. on the left side where would be referred to as printers, right click and select "reset printing system...". »
    4. click on the "Reset" button when asked to confirm
    5. Enter your password, and then click OK (if prompted)
    6. Once completed, (notifications cannot pop up) you will simply see the Virgin 'printers & Scanners', just close

    Remove the software from HP/Hewlett-Packard:
    1. go on 'Finder '.
    2. go in "Applications".
    3. Locate and open the folder "Hewlett-Packard".
    4. If you see an "Uninstall HP program" listed here then run the uninstall program, otherwise, go to step 8
    5. click on the continue"" button.
    6. Enter your password, and then click OK (if prompted)
    7. When you are finished, click "exit".
    8 remove the HP folder or Hewlett-Packard (if still listed after uninstall) drag the folder to the trash
    9. right click on the Recycle Bin in the dock, click on "Empty" - and then confirm to empty the trash

    Repair disk permissions
    1. in the Finder, click Applications
    2. open the Utilities folder
    3. double-click on the disk utility
    4. on the left side, click on the hard drive which has Yosemite 10.10 installed to highlight
    5. click on the "repair disk permissions" nearly half lower the window (time may vary to finish)
    6. what repairs completed, a message near the bottom window 'Fix full permissions', now you can close the disk utility
    7. click on the Apple in the upper left corner, click "Restart" to restart your Mac

    Manually the drivers of HP printer install v3.0
    1. this link will take you to the apples for v3.0 HP printer drivers download
    2. click on the button 'Download' (remember where your download is if your downloads are not on the dock)
    3. open the "HPPrinterDrviers3.0.dmg".
    4. double-click on the "HewlettPackardPrinterDrivers.pkg".
    5. click on the continue"" button.
    6. After reading the license agreement, click the continue"" button.
    7. click on the button "I agree" If you agree
    8. click on the drive that Yosemite 10.10 is installed on and click on continue
    9. click on the 'Install' button (this will install the drivers for HP to your Mac)
    10. Enter your password, and then click the button 'Install Software' (if prompted)
    11. click on the "Close" button when the message "installation succeeded."

    Add a printer to print the queue
    1. open System Preferences
    2. open Printers and scanners
    3. click on the symbol ' + '.
    4. click on "Add a printer or a Scanner..." »
    5. click on "HP Envy printer 4504.
    6. click on the drop down menu to "use:" and choose "HP Envy 4504 Series."
    7. click on the ' Add ' button.

    Try to print in color.

    Please reply to this message with the result of your troubleshooting. I can't wait to hear strings attached good luck!

Maybe you are looking for