Select statement problem. how to get data in one row

SELECT
razm.datum_sklenitve,
razm.datum_prenehanja,
FROM
zket_zaposlenci zap,
zket_delovna_razmerja razm,
zket_delovne_razporeditve razp,
zket_sistemizacije_dm sistdm,
zket_organizacijske_enote oe,
zket_delovna_mesta delm
WHERE
zap.iid_zaposlenca = razm.iid_zaposlenca and
razm.iid_delovno_razmerje = razp.iid_delovno_razmerje and
sistdm.iid_sistemizacija_dm(+) = razp.iid_sistemizacija_dm and
nvl(sistdm.iid_organizacijske_enote, razp.iid_organizacijske_enote) = oe.iid_organizacijske_enote and
sistdm.iid_delovno_mesto = delm.iid_delovno_mesto and
razm.datum_sklenitve <= to_date('31.12.'||:v_datum, 'dd.mm.yyyy') and
nvl(razm.datum_prenehanja, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')) >= to_date('01.01.'||:v_datum, 'dd.mm.yyyy') and
razp.datum_nastopa_dela <= to_date('31.12.'||:v_datum, 'dd.mm.yyyy') and
nvl(razp.datum_prenehanja_dela, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')) >= to_date('01.01.'||:v_datum, 'dd.mm.yyyy') and
zkep_splosno.zkep_hierarh_oe_n(nvl(sistdm.iid_organizacijske_enote, razp.iid_organizacijske_enote), :v_oe, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')) = 1 and
to_char(zkep_splosno.zkep_vrni_prvi_dr(razm.iid_delovno_razmerje, to_date('31.12.'||:v_datum, 'dd.mm.yyyy')), 'yyyy') = :v_datum
and zap.iid_zaposlenca = 1093507
order by razm.datum_sklenitve DESC
return this rows:
datum_sklenitve     datum_prenehanja
1: 01.10.2010 00:00:00 | 31.12.2010 00:00:00
2: 01.10.2010 00:00:00 | 31.12.2010 00:00:00
3: 01.04.2010 00:00:00     | 31.08.2010 00:00:00
4: 01.02.2010 00:00:00     | 31.02.2010 00:00:00
how can i get in one select just this result.
1: : 01.10.2010 00:00:00 | 31.08.2010 00:00:00 (first of A and then the next one of B which is not the same as top of B)
I try everything but i do not know how. If anyone know how to do this.
regards,
MB

Simma wrote:
But the above is not documented.Not only that, but it's string aggregation which isn't meeting the OP's requirements.
Though you could be easily forgiven as the OP hasn't clearly stated the logic behind the requirements.
It could be something like wrapping the original SQL with something like the following...
SQL> ed
Wrote file afiedt.buf
  1  with t as (select date '2010-10-01' as ds, date '2010-12-31' as dp from dual union all
  2             select date '2010-10-01', date '2010-12-31' from dual union all
  3             select date '2010-04-01', date '2010-08-31' from dual union all
  4             select date '2010-02-01', date '2010-02-28' from dual)
  5  --
  6  -- END OF TEST DATA
  7  --
  8  select max(case when rn = 1 then ds else null end) as ds
  9        ,max(case when rn = 2 then dp else null end) as dp
10  from (
11        select ds, dp, row_number() over (order by ds desc nulls last) rn
12        from (
13              select case when lag(ds) over (order by ds desc) = ds and lag(dp) over (order by ds desc) = dp then null else ds end as ds
14                    ,case when lag(ds) over (order by ds desc) = ds and lag(dp) over (order by ds desc) = dp then null else dp end as dp
15              from t
16              order by t.ds
17             )
18*      )
SQL> /
DS                  DP
01/10/2010 00:00:00 31/08/2010 00:00:00
SQL>but who knows?

Similar Messages

  • How to get data from one ui element?

    hi all
    I have a DropDownByIndex and I know how I can get the value selected
    thanks

    HI,
    suppose the dropdownbyindex is bind with the attribute "testName" in the node "Test".
    so the context is like
    Test
      .....testName
    so to get the selected value do like this
    wdContext.nodeTest().getTestElementAt(wdContext.nodeTest().getLeadSelection()).gettestName();
    hope it clear!
    Regards,
    ramesh

  • How to get data from three tables (A,B,C) having one to many relation between A and B .and having one to many reation between b and c

    i have  three tables A,B,C.  there is one to many relation between A and B. and one to many relation existed between table b and c . how will get data from these three tables

    check if this helps:
    select * --you can always frame your column set
    from tableA a
    left join tableB b on a.aid=b.aid
    left join tableC c on c.bid=b.bid
    This is just a general query. However, we can help you a lot more, if you can post the DDL + sample data and required output.
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • How to get data for custom feilds for standard datasource

    i have extracted CRM standard datasource 0CRM_OPPT_I.
    In RSA6 i slected feilds which i want to trnasfer to B Iand i also added some custom feilds.
    and then i went to RSA5 and i activated datasource.then i went to RSA3and  i extracted.
    In rSA3 selection screen all the custom feilds are selcted.
    after extraction if i go to LIST,only some of the custom feilds data is displaying remaining feilds displayed as blank data
    please tel me how to get data
    Thanks in advance
    HP

    Hi Hari,
    Sorry for late reply.
    Once you have done the proper mapping by using the transaction BWA1
    you need to write the BADI code which can be accesible from the following path:
    Go to transaction SPRO
    SAP Implementation guide ->Integration with other mySAP components ->Data transfer to the Business Information Warehouse->
    Settings for the application specific datasources (CRM) ->
    Settings for BW adapter->Execute Badi :BW adapter :Enhancement of datasources in messaging flow.
    Select you the datasource enhancement implementation it will open the BADI Implementation..
    go To interface tab and double click on the method..it takes you to the ABAP screen where you need to write the logic to populate the custom fields..
    Please feel free to mail back if you have any quries.
    All the Best..
    Thanks
    SK

  • How to get Date Format from Local Object.

    Hi All,
    I am new to Web Channel.
    I need to know Date format From date of locale.
    suppose there is a date "01/25/2010" date in date field I want to get string "mm/dd/yyyy". Actually I have to pass date format to backend when I call RFC. 
    Is there any way to get Date format from "Locale" object. I should get date format for local object
    I get local object from "UserSessionData" object but how to get Date format from it.
    I am not looking for Date value. I am looking for current local date format ("mm/dd/yyyy or dd/mm/yyyy or mon/dd/yyyy) whatever local date format.  I could not find example which show how to get date format from "Locale" object.
    Any help will be appreciated with rewards.
    Regards.
    Web Channel

    Hi,
    You can get it from "User" or "Shop" business object.
    Try to get User or Shop Business Object as shown below.
    BusinessObjectManager bom = (BusinessObjectManager) userSessionData.getBOM(BusinessObjectManager.ISACORE_BOM);
    User user = bom.getUser();
    char decimalNotation = user.getDecimalPointFormat().getGroupingSeparator();
    If you are seeing "1,234.00" then above code will return "."
    I hope this information help you to resolve your issue.
    eCommerce Developer.

  • How to get data from a USB-UIRT device using Labview?

    How to get data from a USB-UIRT device using Labview?
    I'm trying to get data from a USB-UIRT device, is it posible with Labview?
    I really appreciate your help, 
    thanks

    You may want to contact the developer of the device for the API and DLL.
    http://65.36.202.170/phpBB2/viewforum.php?f=3

  • How to get data type of variable in program..

    Hi ABAP Guru.
    I need to know how to get data type of variable or any structure field.. because I got short dump when use command REPLACE ALL OCCURANCE ... with variable/structure field that has data type I or P, I think it should be used with data type CHAR only, So I need to check the data type first.
    Please give me your advice
    Thank you all.
    Nattapash C.

    data : v_value type i,
             v_char(10) type c.
    v_value = 10.
    move v_value to v_char.
    REPLACE ALL OCCURRENCES of '#' from v_char....
    Best regards,
    Prashant

  • How to get data in WDDINIT method

    hi...
    how to get data passed through url in WDDINIT method, ... the data is comming in the inbound plug, but plug is executed after WDDINIT...
    thank you.

    Hello Kailash,
    By saying that your data comes in through Inbound Plug itself means that that is the point of access for the data. If there is some standard data, that you can provide through WDDOINIT (e.g. initilizations) but in case of navigation, plugs and events are the only way to send data.
    Hope this helps.
    Regards,
    Neha

  • How to get data from MS CRM into Crystal Reports

    Hello All,
    Can anybody tell me how to get data into   crystal XI reports with MS CRM.
    Thanks in Advance
    Ramesh

    First you should refer to the Rules of Engagement and then add more info.
    Start off by telling us what version of CR are you using and what is MS CRM?
    Thank you
    Don

  • How to get data into BI system

    Hi Experts,
             I am a newbie to SAP BI. Please guide me how to get the data from tha R/3 tables into BI system tables. When I check the data in SE11 in R/3 (for ex: VBAK, VBAP...... etc), I could see all the records. Now how can I get the same data in BI system tables? When I check in BI system with Tcode SE11, I couldn't find any data for the tables VBAK,VBAP..... etc. Please guide me how to fill these tables in BI from R/3. Points will be rewarded for the solutions.
    Regards,
    Ravi

    Hi Ravi,
        U can follow the link and know how to get data from R/3 to BI.
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/28/4c553c42360a40e10000000a114084/frameset.htm">data sources</a>
       Still I give overview to u. U need to create data source in R/3 side, replicate them in BI and use them in your info source to load the data. Data source are of two type application specific (system generated) and generic (customer defined). Data Extraction can be based on table, view or infoset query.
    hope this helps.
    Regards,
    Purvang
    Assigning Point is to say Thanks in SDN *

  • How to get data on the next page in case of templates if data is more ?

    please tell me how to get data on the next page while i m using template in my first page , if data is more howw it can be displayed on the next page ?

    HI Asim,
    template is fixed we  it can't be expand . u can better to use table line it can automaticlly expending if data is more ... u can create one more page like page 2 and create a window for entire second page ..then assign it in first page (next page page2).
    regards
    kiran kumar.

  • How i get data in matrix grid from A/P Invoice

    How i get data in matrix grid from A/P Invoice before click add button

    Hi,
    Are you trying to read the data in the matrix of a system form? Then you only have to look for the matrix with the ID you can see by visualising the System Information in B1 and then directly read from the matrix cells (using columns element in matrix), the DBDataSources are not filled in until the document has been added to the database.
    There are many messages in this forum talking about how to read information in matrix item, just make a search for it.
    Hope it helps
    Trinidad.

  • How Adobe gets DATE and its format?

    Hello,
    I am getting current (todays) date by using below JS in some flds, and by using below FormCalc for some flds into my_form,
    JS:
    var currentTime = new Date()
    Form Calc:
    $.rawValue = num2date(date(), DateFmt(MM/DD/YYYY))
    But, i dont have much idea that how adobe is getting this date? For my company this is the very first form, hence they are asking me how adobe gets date and its format whether,
    1) From local IP/Interner provider address's date, format?
    2) or user PC/laptop's LOCAL settings date, format? if so, for example, if Germany user (Laptop settings) has a DD.MM.YYYY configured, if this user comes to US on a busines trip and if that user opens the form, then how the date looks like for this user? as per user laptop settings DD.MM.YYYY or local internat provider date format MM//DD//YYYY?
    Thank you

    Hi,
    the date() function returns the number of days since 01.01.1900 for the local date of the current system (related to the system clock of the OS).
    If you travel from Germany to the US but don't update your date/time settings, then it returns the same date in the US as in Germany.
    You can check the behavior by changing your local date/time setting or the timezones.

  • How to get data out of XML?

    Hi,All.
    I am running SAX (JAXP1.01) in Applet to process XML file. My question is how to get data out of xml format according to the field name (@age,@rank etc)
    and write into string buffer seperated by comma.
    Should I use SAX or DOM? (file size is big)
    My xml as follow :
    <ROOT>
    <FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@team/relay}">
         <ObjectName>Field124</ObjectName>
         <FormattedValue>HUNTER</FormattedValue>
         <Value>HUNTER</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@age}">
         <ObjectName>Field125</ObjectName>
         <FormattedValue> 19</FormattedValue>
         <Value> 19</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@Rank}">
         <ObjectName>Field126</ObjectName>
         <FormattedValue>43</FormattedValue>
         <Value>43</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{results.athrel_name}">
         <ObjectName>Field127</ObjectName>
         <FormattedValue>1-1 NORRIE</FormattedValue>
         <Value>1-1 NORRIE</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@timefield2}">
         <ObjectName>Field128</ObjectName>
         <FormattedValue>1:54.75</FormattedValue>
         <Value>1:54.75</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@timefield1course}">
         <ObjectName>Field129</ObjectName>
         <FormattedValue/>
         <Value/>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@timefield1std}">
         <ObjectName>Field130</ObjectName>
         <FormattedValue/>
         <Value/>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@timefield2course}">
         <ObjectName>Field131</ObjectName>
         <FormattedValue/>
         <Value/>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@timefield2std}">
         <ObjectName>Field132</ObjectName>
         <FormattedValue>QT</FormattedValue>
         <Value>QT</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@points(left)}">
         <ObjectName>Field133</ObjectName>
         <FormattedValue/>
         <Value/>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@pointsdecimal}">
         <ObjectName>Field134</ObjectName>
         <FormattedValue/>
         <Value/>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:decimal" FieldName="{@points(right)}">
         <ObjectName>Field135</ObjectName>
         <FormattedValue>0</FormattedValue>
         <Value>0.00</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@timefield1}">
         <ObjectName>Field136</ObjectName>
         <FormattedValue>1:55.98</FormattedValue>
         <Value>1:55.98</Value>
    </FormattedReportObject>
    <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{@Rank}">
         <ObjectName>Field137</ObjectName>
         <FormattedValue>43</FormattedValue>
         <Value>43</Value>
    </FormattedReportObject>
    Repeat...
    </FormattedReportObject>
    </ROOT>
    ------------------------------------------------

    For big files use SAX: quicker and less memory usage.
    The xerces parser from Apache has some examples. Basically what you do is scan the XML, remembering what tag you are and once you find the right tag, read the contents.

  • How to get  data with the raw pattern from resultset ?

    would you tell me how to get data with the raw pattern from resultset ?
    thank you in advance!
    longgger2000

    I tried getBytes() and getObject()
    , but I can not get the right result , for example the
    data in oracle database is 01000000DFFF, when In used
    the method of getBytes() and getObject(), I get the
    result of [B@1c2e8a4, very different , please tell me
    why !
    thank you
    longgger2000
    [B is byte arrayseem that it return an bytes array for you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Hello! I have already taken Apple invoice, what I must do next that I have  IOS DEVELOPER PROGRAM ?

    what I must do next that I have  IOS DEVELOPER PROGRAM ? I have already paid 100 dollars for developer program but I havent this program. And I already have invoice of my payment and I havent email with activation code

  • Using bytes or chars for String phonetic algorithm?

    Hi all. I'm working on a phonetic algorithm, much like Soundex. Basically the program receives a String, read it either char by char or by chunks of chars, and returns its phonetic version. The question is which method is better work on this, treatin

  • Third-Party SNMP Traps on SMC

    Is it possible to receive SNMP Traps from Third-Party applications on SMC(Sun Management Center) If possible, how can this be configured on SMC and how can I import the Third-Party SNMP MIB. Thanks Regards, Rauf Ghafur

  • JRockit as fast or faster than Sun

    I've been very impressed by my tests with JRockit. For the code that I've tried so far, I've found it to generally be at least as fast as Sun's latest 1.4.1 JVM and in some cases substantially faster. Great work. From profiling the execution under VT

  • Max brightness on start up

    I've had my iMac for a couple of years. Just recently, every time I start up, the display brightness is maxed all the way up as the default, and I have to turn it back down. So it's not remembering the setting I use. Very irritating. Any way to fix t