How to achieve this result ?

I've two date. I want to know the month and year name and the days between this two.
Like. First date is 10/01/2012
Second date is 20/04/2012
I want..
January 2012    21 Days
February 2012  29 Days
March 2012     31 Days
April 2012    20 DaysAny idea ?

Hi,
In addition to Frank's solution, you can also do it as follow so you don't have to group by :SQL> l
  1  select
  2  to_char(add_months(trunc(to_date('&&dstart.','dd/mm/yyyy'),'mm'),level-1),'fmMonth yyyy') mthy
  3  ,least(
  4       last_day(add_months(trunc(to_date('&&dstart.','dd/mm/yyyy'),'mm'),level-1))
  5       ,to_date('&&dend.','dd/mm/yyyy')
  6  )
  7  - greatest(
  8       add_months(trunc(to_date('&&dstart.','dd/mm/yyyy'),'mm'),level-1)-1
  9       ,to_date('&&dstart.','dd/mm/yyyy')
10  ) days
11  from dual
12* connect by level <= trunc(months_between(to_date('&&dend.','dd/mm/yyyy'), to_date('&&dstart.','dd/mm/yyyy')))+1
SQL> define dstart="10/01/2012"
SQL> define dend="20/04/2012"
SQL> /
MTHY                       DAYS
Janvier 2012                 21
Fevrier 2012                 29
Mars 2012                    31
Avril 2012                   20
4 ligne(s) selectionnee(s).
SQL> define dstart="10/01/2012"
SQL> define dend="20/01/2012"
SQL> /
MTHY                       DAYS
Janvier 2012                 10
1 ligne selectionnee.
SQL> define dstart="10/01/2012"
SQL> define dend="20/03/2013"
SQL> /
MTHY                       DAYS
Janvier 2012                 21
Fevrier 2012                 29
Mars 2012                    31
Avril 2012                   30
Mai 2012                     31
Juin 2012                    30
Juillet 2012                 31
Aout 2012                    31
Septembre 2012               30
Octobre 2012                 31
Novembre 2012                30
Decembre 2012                31
Janvier 2013                 31
Fevrier 2013                 28
Mars 2013                    20
15 ligne(s) selectionnee(s).There is 1 row generated for each month in the interval instead of 1 for each day.
That shouldn't be a big benefit, unless the interval spans several centuries !
:-)

Similar Messages

  • How to achieve this result using sql query?

    hello gurus,
    i have a table like this
    id    name
    1       a
    2       b
    3       c
    4       d
    5       e
    6       f
    7       g
    8       h
    9       i
    10     j
    11     k
    12     l
    13     m now my result should be like this
    id    name  id   name   id   name
    1       a     6       f      11     k
    2       b     7       g     12     l
    3       c     8       h     13     m
    4       d     9       i
    5       e     10      jhow to achieve it by sql query ?
    thanks and regards,
    friend
    Edited by: most wanted!!!! on Feb 22, 2012 5:55 AM

    hi,
    Did you mean this:
    with a as
    (select 1 id ,'a' name from dual
    union all select 2 id ,'b' name from dual
    union all select 3 id ,'c' name from dual
    union all select 4 id ,'d' name from dual
    union all select 5 id ,'e' name from dual
    union all select 6 id ,'f' name from dual
    union all select 7 id ,'g' name from dual
    union all select 8 id ,'h' name from dual
    union all select 9 id ,'i' name from dual
    union all select 10 id ,'j' name from dual
    union all select 11 id ,'k' name from dual
    union all select 12 id ,'l' name from dual
    union all select 13 id ,'m' name from dual
    select
      id_1
      ,name_1
      ,id_2
      ,name_2
      ,id_3
      ,name_3
    from
      select
        id id_1
        ,name name_1
        ,lead(id,5) over (order by id) id_2
        ,lead(name,5) over (order by id) name_2
        ,lead(id,10) over (order by id)  id_3
        ,lead(name,10) over (order by id) name_3
        ,rownum r
      from
        a
    where
      r <=5
    D_1                   NAME_1 ID_2                   NAME_2 ID_3                   NAME_3
    1                      a      6                      f      11                     k     
    2                      b      7                      g      12                     l     
    3                      c      8                      h      13                     m     
    4                      d      9                      i                                   
    5                      e      10                     j Regards,
    Peter

  • How to achieve this result? Colored object, rest is B&W

    Where an object is in color and the rest is in black & white?

    In photoshop elements 9 an easy way is to use the Smart Brush Tool.
    Pick one the Black and white presets, then paint on the areas in the image you want black and white.
    To add to the area pick the brush with + sign, to subtract from the area use the brush with the - sign.
    You can change to any of the other black and white presets to see how they look and if the smart brush
    tool won't select or deselect some areas easily, you can use the Detail Smart Brush Tool to select or
    deselect those areas. (click on the screenshot below to enlarge)
    For more questions about photoshop elements, the folks over on the photoshop elements forum could probably answer them better
    since elements doesn't have the same features as the full photoshop version.
    http://forums.adobe.com/community/photoshop_elements

  • How to achieve the results by Query ??

    Hello Guys,
    I have couple tables which I need to join to get the result....This is what is in the tables...
    CList Table
    CID, Name
    A, ABC
    B,CDE
    C,JFK
    JList Table
    JID, Name
    1, Something
    2, Another
    3, Else
    4, Should be something
    JOb_2_Courses
    JobID, CourseID
    1,A
    1,B
    2,C
    Employee Table
    EID, Job_ID
    1A, 1
    2A,1
    3B,1
    2C,2
    23D,3
    CStatus Table
    StatusID, Desc
    1,Completed
    2,Pending Approval
    3,Declined
    4,Scheduled
    5,Register
    Now user can only register the course which are related with their job....NO course else.....
    When they register it is moved to temp_course_registration and then once completed to COURSE_HISTORY
    For Example : So Employee : 1A will see two courses to register A and B...
    Say he registers A....it makes an entry in temp_course_registration table with the course id, employeeid and date....
    With further steps once that status is updated to '1'.....the course is deleted from temp_course_registration and is moved to course_history........
    Now to show to the user...I need to include all my tables in the query and on the basis of status, show necessary things to the user....
    Output :
    Course_ID, Status.............
    Say if they completed the course will come from course_history, if in the process will come from temp_course_registration.....if nothing is in the tables for the specific employee...this means status is '5' and they need to register everything...
    Can someone let me know, how to achieve the results....
    Thanks,
    Harsimrat

    Hello
    I'm off home now so I can't look at the query, but for future reference, if you want to improve your chances of getting help, you need to provide simple create table statements, and test data to go with it. I've done that with what you provided and hopefully someone else will be able to help. Also, you were asked if you could provide this in your other thread...
    CREATE TABLE CList(CID varchar2(1), Name varchar2(3))
    insert into clist values('A', 'ABC');
    insert into clist values('B','CDE');
    insert into clist values('C','JFK');
    CREATE TABLE JList(JID number, Name varchar2(30))
    insert into jlist values(1, 'Something');
    insert into jlist values(2, 'Another');
    insert into jlist values(3, 'Else');
    insert into jlist values(4, 'Should be something');
    CREATE TABLE JOb_2_Courses(JobID number, CourseID varchar2(1))
    insert into job_2_courses VALUES(1,'A');
    insert into job_2_courses VALUES(1,'B');
    insert into job_2_courses VALUES(2,'C');
    CREATE TABLE Employee (EID varchar2(3), Job_ID number)
    INSERT INTO employee VALUES('1A', 1);
    INSERT INTO employee VALUES('2A',1);
    INSERT INTO employee VALUES('3B',1);
    INSERT INTO employee VALUES('2C',2);
    INSERT INTO employee VALUES('23D',3);
    CREATE TABLE CStatus(StatusID number, Descr varchar2(30))
    insert into cstatus values(1,'Completed');
    insert into cstatus values(2,'Pending Approval');
    insert into cstatus values(3,'Declined');
    insert into cstatus values(4,'Scheduled');
    insert into cstatus values(5,'Register');HTH
    David

  • How to Achieve this in SQL Query?

    How to Achieve this ?
    I have a table with numeric value populated like this
    create table random_numeral (numerals Number(10));
    insert into random_numeral values (1);
    insert into random_numeral values (2);
    insert into random_numeral values (3);
    insert into random_numeral values (4);
    insert into random_numeral values (5);
    insert into random_numeral values (6);
    insert into random_numeral values (56);
    insert into random_numeral values (85);
    insert into random_numeral values (24);
    insert into random_numeral values (11);
    insert into random_numeral values (120);
    insert into random_numeral values (114);
    Numerals
    1
    2
    3
    4
    5
    6
    56
    85
    24
    11
    120
    114
    I want to display the data as follows
    col1 / col2 / col3
    1 / 2 / 3
    4 / 5 / 6
    11 / 24 / 56
    85 / 114 / 120
    Can anyone Help me?

    I hope there might be some simple way to do this and waiting for experts to reply.
    Try the below query.
    SQL> select * from random_numeral;
      NUMERALS
             1
             2
             3
             4
             5
             6
            56
            85
            24
            11
           120
      NUMERALS
           114
           100
           140
    14 rows selected.
    SQL> select a.numerals ||' / '||b.numerals||' / '||c.numerals from
      2          (select numerals,rownum rn1 from
      3          (
      4              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
      5              from random_numeral
      6          )
      7          where rn=1) a,
      8          (select numerals,rownum rn1 from
      9          (
    10              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
    11              from random_numeral
    12          )
    13          where rn=2) b,
    14          (select numerals,rownum rn1 from
    15          (
    16              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
    17              from random_numeral
    18          )
    19          where rn=0) c
    20  where   a.rn1=b.rn1(+)
    21  and b.rn1=c.rn1(+)
    22  /
    A.NUMERALS||'/'||B.NUMERALS||'/'||C.NUMERALS
    1 / 2 / 3
    4 / 5 / 6
    11 / 24 / 56
    85 / 100 / 114
    120 / 140 /
    SQL>Cheers,
    Mohana

  • How to achieve this tree table (displaying/modifying non leaf level details) ?? Image inside

    Region
    location
    Dept
    Budget Available
    Allot Budget
    Unused Budget
    Decision for unused budget
    US
    200$
    User Input
    NY
    100$
    User Input
    CA
    100$
    User Input
    HR
    50$
    User Input
    IT
    50$
    User Input
    ---------30$--------
    20$
    LOV
    Add to Location
    Use for Future Project
    Add to Region
    Spend as Bonus
    How to achieve this tree table ?
    My client wants that they should also be able to manage budge at Location or region level not only at the leaf(Dept) level.
    I did a lot of research and finally found out that the details can only printed at the leaf(Dept) level.......
    We can not hard code Region, locations and departments in table rows. When table tree is displayed we will only show all the regions... (US, UK, SA, IND, AUS, CAN,RUS, JPN.... etc..)
    For Example:
    Locations for US (NY, CA, OKH, WC...... etc.)
    Locaitons for UK (SC, ENG, WL..... etc)  and so on......
    Departments for CA (HR, IT, ADMIN, FIN, TRVL, OPRN........ etc. ..)
    Thanks in advance... It will be really great help if I get some breakthrough...
    -Rahul

    Hi,
    what if you add a transient attribute to those view objects? This way you don't need to change the table structure.
    Frank

  • How to achieve this process in SAP SD module??

    Hi,
    I want to know whether this kind of scenario could be achieved in SAP system SD module??
    We have only one material which the value or price is 10000USD, and this material could be only used 5 times. Everytime it is used, it will be goods issued in the system,  and its value will be decreased 2000USD, this means this material will be drawn back into system and its value will be showed as 8000USD.  And next time it will be 6000...4000...2000...0
    After 5 times this kind of process, then this material is no-used any more.
    I just want to know could 'Draw back' and 'decrease 2000USD everytime'  'show 'previous value - 2000' as new value every drawn back time' ....
    how to achieve this in SAP SD system??
    Thank you very much.

    Hi,
    This can be mapped in Foreign trade.You need to use Licensing functionality.Each  time you use it,  it  depreciate by document value.
    Thanks,
    Vrajesh

  • I don't want my Time Capsule to link ti Internet, does anyone know how to achieve this ? Thanks Don

    I don't want my Time Capsule to link to Internet, does anyone know how to achieve this ? Thanks Don

    Don,
    We have no idea how you have your network set up, or what devices other than a Time Capsule that you might have, so it it impossible to provide an answer for you based on what we know at this time.
    Can you provide some details so that we can understand how you have things setup, what devices that you have, etc?
    The Time Capsule does need to connect to the Internet to receive firmware updates from Apple, so you would be missing out on some significant things......like a recent important security update....if you try to configure the Time Capsule to connect in the way that you ask about.
    Backups will not be "automatic" if you configure the Time Capsule without an Internet connection. You will have to manually switch networks whenever you want to back up, and then switch back again to your "other" network for normal use. Quite a hassle for most users, even if it can be done.

  • How to achieve this using UWL

    Hi Friends,
    I have the following requirement for Travel request workflow and Invoice approval workflow. Please let me know how to achieve this.
    While sending a work item to sap inbox we will put the base BO in the task container right so that the approver can open the particular transaction.I need the same functionality in UWL but instead of the BO i need to place some link so that the user can open an iview or webdynpro application. Basically the user dont want to login to SAP GUI he needs everything to be done in Portal itself.
    Do we need to do some settings in tcode SWFVISU for this or do we need to change the associated xml file in UWL to provide the link to iview. Please advice.

    Hi,
    If i understand your requirement correctly, you want to place a link of BO in UWL but don't want that to get to SAP GUI. Right ?
    I think it's possible. We had ECC 6.0 and EP 6.0 with SP 11. And, we had the requirement of showing up the TRIP BO in UWL thru' an iVIEW. We tried the SWFVISU and it didn't work. But, i think this facility has been taken care in later service packs. Pl approach SAP and they should be able to help you out. I'm not sure about the details of the solution SAP provided us, but it worked for us..like there will be a button "Display XXXXXX" which infact opens up your BO in UWL without logging into GUI.
    Hope this helps.
    venu

  • How to achieve this photographic slide display/navigation

    Hi,
    I would like to know how to achieve the following:
    1. Go to
    http://www.corneliaadams.com/
    & then click on 'michael mundy' link. this opens up a page with
    a slideshow of photographs that i really love. I have very basic
    knowledge of scripting ,a nd i usually achieve my goals by
    modifying flas that i have seen or by following tutorials (as
    opposed to writing it myself). the great thng about the above
    version is taht the images slide to an exact position when you
    click on the forward or back arrows, and they slow down ever so
    slightly just before stopping. Can anyone point me in the right
    directoin with how to achieve this, or offer a tutorial. I am
    really starting from scratch, and would lik eto end up with the
    same clean and professional outcome.
    2. regarding the same above link, when you are at the main
    site, and then you click the michael mundy' link, what is it that
    happens, is it a new html popup page that opens of specified
    dimensions and the embedded swf is set to stretch to maximum
    width/height? or is it a lone swf that pops up (with no html page)?
    or is that impossible?
    Many Many Many thanks in advance,
    Cheska

    I hope there might be some simple way to do this and waiting for experts to reply.
    Try the below query.
    SQL> select * from random_numeral;
      NUMERALS
             1
             2
             3
             4
             5
             6
            56
            85
            24
            11
           120
      NUMERALS
           114
           100
           140
    14 rows selected.
    SQL> select a.numerals ||' / '||b.numerals||' / '||c.numerals from
      2          (select numerals,rownum rn1 from
      3          (
      4              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
      5              from random_numeral
      6          )
      7          where rn=1) a,
      8          (select numerals,rownum rn1 from
      9          (
    10              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
    11              from random_numeral
    12          )
    13          where rn=2) b,
    14          (select numerals,rownum rn1 from
    15          (
    16              select numerals,mod(row_number() over(partition by 1 order by numerals),3)
    17              from random_numeral
    18          )
    19          where rn=0) c
    20  where   a.rn1=b.rn1(+)
    21  and b.rn1=c.rn1(+)
    22  /
    A.NUMERALS||'/'||B.NUMERALS||'/'||C.NUMERALS
    1 / 2 / 3
    4 / 5 / 6
    11 / 24 / 56
    85 / 100 / 114
    120 / 140 /
    SQL>Cheers,
    Mohana

  • How to achieve this specific drop shadow effect?

    Dear all,
    Does anybody know how to achieve this specific drop shadow effect in InDesign: a step by step instruction, a plugin, etc?
    Regards,
    Kasyan

    Kasyan,
    I generally just use the basic feather. I draw the object with a few clicks of the pen, fill with whatever color, set the tint if desired, then use settings more or less as below.
    Mike

  • How to achieve this Effect?

    Hey everyone i was wondering if you guys had any idea how to achieve this effect in flash.....http://www.youtube.com/watch?v=QftcJtvLr8g

    While you could probably do this in Flash, it is much more simply done using AfterEffects. There's a splendid text tool that can be tortured into effects like this. Have a look at the podcasts from Creative Cow on AfterEffects for some interesting examples.

  • Does anyone know how to achieve this in Photoshop? Any help is appreciated, thanks.

    Hello,
    I'm relatively new to Photoshop so if you know how to do this, please explain by telling me where I click. E.g. File>Open
    Does anyone know how I would achieve this exact effect in Photoshop in the image above (without the circular logo)? The 2 light blue type of effects, one at the top of the image, the one at the bottom of the image. I don't know how to achieve this effect, please show me if you know how. I'm using Photoshop CS5.
    I have looked through hundreds of tutorials, none provide me any clue as to how this is achieved.
    Or does anyone know a tutorial on how this effect is achieved?
    Thank you for your help.

    Yes, it would have been faster and more constructive to point out exactly where to find information rather than scold you.
    Check out the Option bar that one gets under the Menu bar. If it is not showing, go to windows>Options.
    More info: http://helpx.adobe.com/photoshop/using/tools.html#using_the_options_bar
    If you select the brush tool, you will notice a flow value, that you can lower; and a Mode drop down list.
    paint tool options: http://helpx.adobe.com/photoshop/using/painting-tools.html#paint_tool_options
    Set the mode to Linear Dodge, then for the next stroke set it to lighten.
    Blending modes explanations with links about their effects http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-77eba.h tml
    Have fun learning Photoshop!

  • In graph at the a particular value (threshold value) in Y-axis horizontal line have to display like a alert for the user. How to achieve this? (In WebI)

    How to achieve this in WebI?

    Just create a measure for it. Here's an example in E-Fashion:
    This is Sales Revenue for 2006; all I've done is added a new measure called "Target", which is just:
    =900000
    The chart is a combined chart. The Z Axis scale wasn't the same as the Y so I manually changed it to hard coded minimum and maximum values - you get the idea.
    HTH
    NMG

  • Particle effect -how to achieve this kind of effect exactly

    Hello   please help me to achieve this type of flickering particle effect.  how to achieve this in After effect  which is shown at 0.8 sec to 0.11  in the attached link video. http://www.istockphoto.com/stock-video-2682258-hearts.php

    I can't give you the exact settings but you could use Trapcode Particular with a custom particle or CC Particle world. Just turn gravity to 0 and set up a custom particle.
    Your particle layer will be behind the spinning hearts layer. This should get you going in the right direction.

Maybe you are looking for