Query to split one row to multiple based on date range

Hi,
I need to split single row into multple based on date range defined in a column, start_dt and end_dt
I have a data
ID      From date             End_dt                measure
1        2013-12-01         2013-12-03            1
1        2013-12-04         2013-12-06            2
2        2013-12-01         2013-12-02            11
3        2013-12-03         2013-12-04          22
I required output as
ID      Date                      measure
1        2013-12-01              1
1        2013-12-02              1
1        2013-12-03              1
1        2013-12-04              2
1        2013-12-05              2
1        2013-12-06              2
2        2013-12-01             11
2        2013-12-02             11
3        2013-12-03             22
3        2013-12-04            22
Please provide me sq, query for the same
Amit
Please mark as answer if helpful
http://fascinatingsql.wordpress.com/

Have a calendar table for example and then probably using UNION ALL from date  and stat date JOIN the Calendar table
SELECT ID,From date  FROM tbl
union all
SELECT ID,End_dt FROM tbl
with tmp(plant_date) as
   select cast('20130101' as datetime)
   union all
   select plant_date + 1
     from tmp
    where plant_date < '20131231'
select*
  from  tmp
option (maxrecursion 0)
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • Query to display one row per group based on highest value

    I have the following table and I want to be able to create a query that displays only the highest number based on a group. (see below)
    Acode
    aname
    anumber
    a
    Jim
    40
    a
    Jim
    23
    a
    Jim
    12
    b
    Sal
    42
    b
    Sal
    12
    b
    Sal
    3
    Acode
    aname
    anumber
    a
    Jim
    40
    b
    Sal
    42

    Multiple ways
    using aggregation
    SELECT Acode,aname,MAX(anumber) AS anumber
    FROM table
    GROUP BY Acode,aname
    using subquery
    SELECT Acode,aname,anumber
    FROM table t
    WHERE NOT EXISTS (
    SELECT 1
    FROM table
    WHERE Acode = t.Acode
    AND aname = t.aname
    AND anumber > t.anumber
    using analytical function
    SELECT Acode,aname,anumber
    FROM
    SELECT *,ROW_NUMBER() OVER (PARTITION BY Acode, aname ORDER BY anumber DESC) AS Rn
    FROM table
    )t
    WHERE Rn = 1
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Split one row into multiple columns

    Hi,
    Data in one CLOB column in a table storing with delimiter, ##~~##. Ex. ##~~##abc##~~##defgh##~~##ijklm##~~##nopqr (data starts with delimiter). Please help me to split the data into multiple rows like below and it should be in the same order.
    abc
    defgh
    ijklm
    nopqr
    I am using Oracle 11g.
    Thanks.

    Thanks Hoek for your response. Before posting my question in the forum, I tried similar query. It is working with one character as delimiter.
    with test as (select 'ABC,DEF,GHI,JKL,MNO' str from dual )
    select regexp_substr (str, '[^,]+', 1, rownum) split
    from test
    connect by level <= length (regexp_replace (str, '[^,]+')) + 1;
    Above query is giving correct result by fetching 5 rows. I have modified the query like below...
    with test as (select 'ABC,,,DEF,,,GHI,,,JKL,,,MNO' str from dual )
    select regexp_substr (str, '[^,,,]+', 1, rownum) split
    from test
    connect by level <= length (regexp_replace (str, '[^,,,]+')) + 1;
    Above query resulting 13 rows and last 8 rows are nulls. Number of null rows are increasing, if I increase number of characters in delimiter. Could you please tell me how to avoid those null rows.
    Thanks.

  • How can I split one row to multiple rows

    Table like this
    CREATE TABLE T(ID NUMBER(12),START_DATE DATE,END_DATE DATE,ORDER_ID NUMBER(12),PROD_ID NUMBER(12));
    data like this
    ID START_DATE END_DATE ORDER_ID PROD_ID
    1 2013-01-01 2013-03-31 12 123
    2 2013-04-01 2013-06-30 12 123
    3 2013-01-01 2013-05-30 12 234
    4 2013-02-01 2013-04-30 13 123
    5 2013-07-01 2013-09-30 13 345
    I want the result like this
    ID DIFF_DATE ORDER_ID PROD_ID
    1 201301 12 123
    2 201302 12 123
    3 201303 12 123
    4 201304 12 123
    5 201305 12 123
    6 201306 12 123
    7 201301 12 234
    8 201302 12 234
    9 201303 12 234
    10 201304 12 234
    11 201305 12 234
    12 201302 13 123
    13 201303 13 123
    14 201304 13 123
    15 201307 13 345
    16 201308 13 345
    17 201309 13 345
    how to write the sql ?
    Edited by: 990390 on 2013-3-31 下午11:42

    SQL> WITH t(iD ,START_DATE ,END_DATE ,ORDER_ID ,PROD_ID) AS(
      2  SELECT 1, to_date('2013-01-01','yyyy-mm-dd'), to_date('2013-03-31','yyyy-mm-dd'), 12, 123 FROM dual UNION ALL
      3  SELECT 2, to_date('2013-04-01','yyyy-mm-dd'), to_date('2013-06-30','yyyy-mm-dd'), 12, 123 FROM dual UNION ALL
      4  SELECT 3, to_date('2013-01-01','yyyy-mm-dd'), to_date('2013-05-30','yyyy-mm-dd'), 12, 234 FROM dual UNION ALL
      5  SELECT 4, to_date('2013-02-01','yyyy-mm-dd'), to_date('2013-04-30','yyyy-mm-dd'), 13, 123 FROM dual UNION ALL
      6  SELECT 5, to_date('2013-07-01','yyyy-mm-dd'), to_date('2013-09-30','yyyy-mm-dd'), 13, 345 FROM dual
      7  )
      8  SELECT add_months(MY_DATE , ROW_NUMBER() OVER(PARTITION BY Q.ORDER_ID, Q.PROD_ID ORDER BY ROWNUM)-1) ddate,
      9         Q.ORDER_ID,
    10         Q.PROD_ID
    11    FROM (SELECT MIN(T.START_DATE) MY_DATE,
    12                 MAX(T.END_DATE),
    13                 MONTHS_BETWEEN(MAX(T.END_DATE),MIN(T.START_DATE))+1 CNT,
    14                 T.ORDER_ID,
    15                 T.PROD_ID
    16            FROM t
    17           GROUP BY T.ORDER_ID, T.PROD_ID) Q,
    18         TABLE (SELECT COLLECT(ROWNUM) FROM DUAL CONNECT BY LEVEL <= Q.CNT)
    19   ORDER BY Q.ORDER_ID, Q.PROD_ID
    SQL> /
    DDATE         ORDER_ID    PROD_ID
    01.01.2013          12        123
    01.02.2013          12        123
    01.03.2013          12        123
    01.04.2013          12        123
    01.05.2013          12        123
    01.06.2013          12        123
    01.01.2013          12        234
    01.02.2013          12        234
    01.03.2013          12        234
    01.04.2013          12        234
    01.05.2013          12        234
    01.02.2013          13        123
    01.03.2013          13        123
    01.04.2013          13        123
    01.07.2013          13        345
    01.08.2013          13        345
    01.09.2013          13        345
    17 rows selected
    SQL> ----
    Ramin Hashimzadeh
    Edited by: Ramin Hashimzadeh on Apr 1, 2013 12:15 PM

  • Splitting one row to multiple rows

    Hi
    I am new to Oracle so please pardon me if any mistakes
    I have a requirement where in sorurce table table 1 the data is as below
    INPUT.......
    col1 col2 col3 Fromdate Todate
    xxx yyy 200 2010-01-01 2010-03-01
    OUTPUt.....should be as follows
    Col1 Col2 Col3 Month
    xxx yyy 20 jan
    xxx yyy 20 feb
    xxx yyy 20 mar
    How can we acheive this?
    Edited by: user13103678 on May 10, 2010 11:23 PM

    Hi,
    Please post your question in the "SQL and PL/SQL" forum for a better/faster response.
    SQL and PL/SQL
    PL/SQL
    Thanks,
    Hussein

  • Split single row in multiple rows based on date range

    I need sql script that can split single row in multiple rows based on start date and end date column in table.
    Thank you

    I agree to your suggestion of having a dates table permanently in the database. Thats how we also do for most of our projects as well
    But in most projects the ownership  of table creation etc lies with the client as they will be the DBAs and will be design approval authorities. What I've seen is the fact that though
    many of them are in favour of having calendar table they dont generally prefer having a permanent table for numbers in the db. The best that they would agree is for creating a UDF which will have
    tally table functionality built into it based on a number range and can be used in cases where we need to multiply records as above.
    Wherever we have the freedom of doing design then I would also prefer creating it as a permanent table with required indexes as you suggested.
    >> many of them are in favour of having calendar table they dont generally prefer having a permanent table
    Those people do not understand about database and are not DBAs :-)
    It is our job to tell them what is right or wrong.
    ** This is a real story! I had a client several years back, who was the CEO of a software company.
    He use the query:
    select * from table_name
    In order to get the last ID!
    The table_name was actually a view that took data from several tables, and the main table that he wanted to get the ID included several string columns, with lot of data!
    he actually pulled all this data to the application, just to get the lat ID in a specific table!
    It is our job as Consultants or DBAs to fix's his misunderstanding :-)
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Split single row into multiple rows containing time periods

    Hi,
    I have a table with rows like this:
    id, intime, outtime
    1, 2010-01-01 00:10, 2010-01-3 20:00
    I would like to split this row into multiple rows, 1 for each 24hr period in the record.
    i.e. The above should translate into:
    id, starttime, endtime, period
    1, 2010-01-01 00:10, 2010-01-02 00:10, 1
    1, 2010-01-02 00:10, 2010-01-03 00:10, 2
    1, 2010-01-03 00:10, 2010-01-03 20:00, 3
    The first starttime should be the intime and the last endtime should be the outtime.
    Is there a way to do this without hard-coding the 24hr periods?
    Thanks,
    Dan Scott
    http://danieljamesscott.org

    Thanks for all the feedback, Dan.
    It appears that the respective solutions provided will give you: a) different resultsets and b) different performance.
    Regarding your 'truly desired resultset' you haven't answered all questions from my previous post (there are differences in the provided examples), but anyway:
    I found that using CEIL or ROUND makes quite a difference, using my 'simple 3 record testset' (30 records vs. 66 records got initially returned, that's less than half of the original). That's quite a difference. However, I must call it a day (since it's almost midnight) for now, so there's room for more optimizement and I haven't thoroughly tested.
    But this might hopefully make a difference performancewise when compared to my previous 'dreaded example':
    SQL> drop table t;
    Table dropped.
    SQL> create table  t as
      2  select 1 id, to_date('2010-01-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-01-03 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      3  select 2 id, to_date('2010-02-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-02-05 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      4  select 3 id, to_date('2010-03-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-03-03 00:10', 'yyyy-mm-dd hh24:mi') outtime from dual;
    Table created.
    SQL> select id
      2  ,      max(intime)+level-1 starttime
      3  ,      case
      4           when level = to_char(max(t.outtime), 'dd')
      5           then max(t.outtime)
      6           else max(t.intime)+level
      7         end outtime
      8  ,      level period      
      9  from   t
    10  connect by level <= round(outtime-intime)
    11  group by id, level
    12  order by 1,2;
            ID STARTTIME           OUTTIME                 PERIOD
             1 01-01-2010 00:10:00 02-01-2010 00:10:00          1
             1 02-01-2010 00:10:00 03-01-2010 00:10:00          2
             1 03-01-2010 00:10:00 03-01-2010 20:00:00          3
             2 01-02-2010 00:10:00 02-02-2010 00:10:00          1
             2 02-02-2010 00:10:00 03-02-2010 00:10:00          2
             2 03-02-2010 00:10:00 04-02-2010 00:10:00          3
             2 04-02-2010 00:10:00 05-02-2010 00:10:00          4
             2 05-02-2010 00:10:00 05-02-2010 20:00:00          5
             3 01-03-2010 00:10:00 02-03-2010 00:10:00          1
             3 02-03-2010 00:10:00 03-03-2010 00:10:00          2
    10 rows selected.
    SQL> By the way: I'm assuming you're on 10g, is that correct?
    Can you give us some information regarding the indexes present on your table?

  • Need help to join two tables using three joins, one of which is a (between) date range.

    I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
    the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
    ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
    [ABCTABLE]
    ABCORDER
    ABCPART
    ABCSERIAL
    ABCDATE
    [ZYXTABLE]
    XYZORDER
    XYZPART
    XYZSERIAL
    XYZDATE1
    XYZDATE2

    Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
    on this computer. There are no "Null" fields in either of the tables. 
    This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
    [MSORDR]
    MSORDER
    MSPART
    MSSERIAL
    MSOPNDATE
    11111111
    4444444
    55555
    2/4/2015
    22222222
    6666666
    11111
    1/6/2015
    33333333
    6666666
    11111
    3/5/2015
    This table has one order for every part number and every serial number.
    [GLORDR]
    GLORDER
    GLPART
    GLSERIAL
    GLSTARTDATE
    GLENDDATE
    ABC11111
    444444
    55555
    1/2/2015
    4/4/2015
    ABC22222
    666666
    11111
    1/5/2015
    4/10/2015
    AAA11111
    555555
    22222
    3/2/2015
    4/10/2015
    Post Query table
    GLORDER
    MSORDER
    GLSTARTDATE
    GLENDDATE
    MSOPNDATE
    ABC11111
    11111111
    1/2/2015
    4/4/2015
    2/4/2015
    ABC22222
    22222222
    1/5/2015
    4/10/2015
    1/6/2015
    ABC22222
    33333333
    1/5/2015
    4/10/2015
    3/5/2015
    This is the SQL minus the between date join.
    SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
    FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART);

  • Moving multiple files by date range and/or file name filtered

    I need to move multiple files by date range and/or by filename (using a filter) to another directory. 
    OR
    How can I get the attributes of files in a directory, something you would see when typing in "dir" in a DOS or ls in UNIX.  I can parse this info and then make a array of files to move.
    The reason for needing this is that I need to move files that are located in another country, and sort them into different directories based on date.  Having to read each file for it's file information adds wasted time that I can't afford.  I am about to create a dos terminal to do a "dir" command to get the information and parse it out.. but I was hoping LV had a function that can get me that info so I don't have build it.
    THanks.

    You should use the 'File/Directory Info' functionality.
    This will return the last modificatoin of the file.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • To select from database table based on date range

    hi
    i have a selection screen in which date range is being given
    say eg 23/06/07  to 23/12/08
    based on this date i want to select data from a ztable
    eg i want to select a field amount from table
    and three is a field date range on the table
    for this particular field i want to select all records for amount field  and factual field falling wiithing this date range and sum it
    eg
    based on date range as in selcetion screen
    select amount( field1)  factual ( field2) from ztable into it_ztable where date = ?....
    please give me code for it  and how to sum all values as i will get from the ztable into internal table the two values as fetched from the ztable
    please suggest asap
    regards
    arora

    hi
    i am using
    sELECT field1 field2 FROM Ztable  INto it_matu
                       where DATE GE sl_dat-low    
                        AND  DATE LE sl_dat-high.   
    i am getting data in internal table but
    say i have twelve records now i want to sum it the both the columns into and use that sum final amount to display
    let me know how to use sume in the intrranal tabl do i need to use control statement
    how to use the sum for two columns and take into a serperate variable to display
    regards
    aRora

  • During import, how to auto split one project into multiple albums based on date?

    I believe I've done enough aperture reserach to get all my terminology right, so here goes...
    I've created a file structure within the aperture inspector the the tune of: 
    Year [folder], Type of event (Occasion, special occasion, holiday, vacation) [folder], Project (Wedding), Album (i.e. Day 1, Day 2 or Pre wedding week, event, honeymoon).
    I also have entire months with 7 or 8 pictures each day, that are of the same type/project (random dog pictures) but are distinctly different days (albums - day in park, in bed at night, watching movie). 
    My question is, can I import one project with multiple albums already created based on the date they're taken.  As I can see it, all I can do is split individual projects automatically by date.  But what if one project is over one month, but has multiple distinct days that would be ideal for albums?  One more example.  We did a trip to San Fran.  One day was touring the city, one day was a concert, another day was touring the city.  All one project, but 3 different albums (in my mind).  I had to import as one project, then separately go in and make albums.  I would like that done automatically.
    My suspicion is that I can not natively do this within aperture, and that I would need something called an "applescript."  I haven't done any reserach into that area, so if that's the case and you know where I can find a script that would do this, I'd appreciate the help. 
    Sorry for the wordiness, just wanted to be clear.  Thanks for any and all help!

    Hi,
    You need to create a new requirement in tcode VOFM for that, together with your ABAP consultant. This requirement will be used in copy contol.
    http://saptechsolutions.com/pdf/VOFMCopyRequirementRoutines.pdf
    MdZ

  • How to return one ROW with Multiple value seperated by Colon in a SQL Query

    Hi,
    I have a SQL query as mentioned.
    select deptno
      from deptI want to mofidfy this query, so that this should return me department list with colon delimeted in one ROW.
    10:20:30:40.......Thanks,
    Deepak

    In 10g:
    select rtrim(xmlagg(xmlparse(content deptno || ':')).getstringval(), ':') data
    from   dept;
    DATA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    10:20:30:40with apologies for the abuse of XML...

  • PUT QUERY RESULT ON ONE ROW INSTEAD OF MULTIPLE ONE

    Hi
    I have two tables with the column id_table1 to join them.
    My first table "table_one" contain 3 fields and one record.
    id_table1 : 1
    table1 : project1
    date_project : 2005/08/01
    My second table "table_two" contain 3 fileds and 3 records which contain the id 1 on the join column.
    id_table2 : 1
    table2 : pdf
    id_table1 : 1
    id_table2 : 2
    table2 : excel
    id_table1 : 1
    id_table2 : 3
    table2 : text
    id_table1 : 1
    If i did a simply join, the result is appear in 3 lines:
    1 project1 2005/08/01 excel
    1 project1 2005/08/01 pdf
    1 project1 2005/08/01 text
    Is this possible to have this result in one query :
    1 project1 2005/08/01 excel pdf text
    I mean to have the result in one row and a separated column for each item of the table2.
    We know how to do it with one column concatened ("excel pdf text") but not with separated column
    ("excel" "pdf" "text")
    Thanks if someone has a solution.
    Alexandre

    SQL> select e.job, d.dname from emp e, dept d where e.deptno = d.deptno;
    JOB       DNAME
    CLERK     RESEARCH
    SALESMAN  SALES
    SALESMAN  SALES
    MANAGER   RESEARCH
    SALESMAN  SALES
    MANAGER   SALES
    MANAGER   ACCOUNTING
    ANALYST   RESEARCH
    PRESIDENT ACCOUNTING
    SALESMAN  SALES
    CLERK     RESEARCH
    CLERK     SALES
    ANALYST   RESEARCH
    CLERK     ACCOUNTING
    14 rows selected.
    SQL> select e.job,
      2  max(decode(d.dname,'RESEARCH',d.dname,null)) "Research",
      3  max(decode(d.dname,'SALES',d.dname, null)) "Sales",
      4  max(decode(d.dname,'ACCOUNTING',d.dname,null)) "Accounting"
      5  from emp e, dept d where e.deptno = d.deptno
      6  group by job
      7  /
    JOB       Research       Sales          Accounting
    ANALYST   RESEARCH
    CLERK     RESEARCH       SALES          ACCOUNTING
    MANAGER   RESEARCH       SALES          ACCOUNTING
    PRESIDENT                               ACCOUNTING
    SALESMAN                 SALESRgds.

  • Convert one row to multiple rows

    Hi
    i have a table Calendar_1 with 4 columns and 1 row
    CREATE TABLE Calendar_1
    Sunday CHAR(1),
    Monday CHAR(1),
    Tuesday CHAR(1),
    Wednesday CHAR(1)
    INSERT INTO Calendar_1 VALUES ('A', 'B', 'C', 'D');
    COMMIT;
    i need to get my output under a single column 'DAYS' as stated below
    DAYS
    A
    B
    C
    D
    Could you please provide me the required SQL
    REgards
    -Learnsequel

    Why not? There is only one row in the table... I think it's simplest way..Performance tuning mantra "Less I/O"
    Access the table once. I does not matter if its simple or complex. Keep the I/O Low.
    Check this out
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set autotrace traceonly explain
    SQL> set linesize 120
    SQL>
    SQL> select sunday from Calendar_1
      2  union all
      3  select monday from Calendar_1
      4  union all
      5  select tuesday from Calendar_1
      6  union all
      7  select wednesday from Calendar_1
      8  /
    Execution Plan
    Plan hash value: 105137738
    | Id  | Operation          | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |            |     4 |    12 |     8  (75)| 00:00:01 |
    |   1 |  UNION-ALL         |            |       |       |            |          |
    |   2 |   TABLE ACCESS FULL| CALENDAR_1 |     1 |     3 |     2   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL| CALENDAR_1 |     1 |     3 |     2   (0)| 00:00:01 |
    |   4 |   TABLE ACCESS FULL| CALENDAR_1 |     1 |     3 |     2   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS FULL| CALENDAR_1 |     1 |     3 |     2   (0)| 00:00:01 |
    Note
       - dynamic sampling used for this statement
    SQL> select decode(l, 1, sunday, 2, monday, 3, tuesday, 4, wednesday) days
      2    from Calendar_1                                                          
      3    cross join (select level l from dual connect by level <= 4)
      4  /
    Execution Plan
    Plan hash value: 2984077981
    | Id  | Operation                       | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |            |     1 |    25 |     4   (0)| 00:00:01 |
    |   1 |  MERGE JOIN CARTESIAN           |            |     1 |    25 |     4   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL             | CALENDAR_1 |     1 |    12 |     2   (0)| 00:00:01 |
    |   3 |   BUFFER SORT                   |            |     1 |    13 |     2   (0)| 00:00:01 |
    |   4 |    VIEW                         |            |     1 |    13 |     2   (0)| 00:00:01 |
    |*  5 |     CONNECT BY WITHOUT FILTERING|            |       |       |            |          |
    |   6 |      FAST DUAL                  |            |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       5 - filter(LEVEL<=4)
    Note
       - dynamic sampling used for this statement
    SQL> Look for the cost in the above plan. What you have done is wrong. Being simple does not make it correct.

  • Convert one row to multiple column dynamic in smartform

    i want to convert on row to multiple column in smartform.As number of column is not per define..Please suggest the way out in smartform

    I saw a post and working perfect. The link is given below.
    http://scn.sap.com/community/abap/blog/2013/10/06/the-case-of-dynamic-columns-in-smartform
    Thanks to Eitan.

Maybe you are looking for