Query issue / double rows

Hi,
I have the following query helping my to have Sales by item, invoice, BP and some UDF.
My point is, when i execute it, some invoice rows appears twice while some other appears only once (as it should be).
Can you help to identify what is causing this and how to remedy it?
SELECT OINV.[CardCode], OINV.[CardName], CRD1.[Country], OINV.[DocNum], OINV.[DocDate],OITM.[U_ACW_FAMILYA], OITM.[U_ACW_FAMILYB], OITM.[U_ACW_FAMILYC],  INV1.[ItemCode], INV1.[Dscription], (INV1.[Quantity] * OITM.[SalFactor2]) AS PackQty, INV1.[unitMsr], INV1.[TotalSumSy] FROM OINV INNER JOIN INV1 ON OINV.DocEntry = INV1.DocEntry INNER JOIN OITM ON INV1.ItemCode = OITM.ItemCode INNER JOIN CRD1 ON OINV.CardCode = CRD1.CardCode
On top of this, if some of you experts can help me to add the code so i can choose a period and a customer group only to filter this query i would really appreciate, i am new to this.

Hi
delete the las inner join.
I think when the BP has two addresses the invoice will be appear twice. Even, if you have the same item twice you will have two results.
To choose a period:
where OINV.docdate >= [%0] and OINV.docdate <= [%1]
To filter by customer group:
1. you have to add the OCRG table
2. you have to add the condition WHERE ocrg.groupname = [%2]
3. you have to add a new inner join: inner join ocrg.groupcode = ocrd.groupcode
Kind regards
Agustín Marcos Cividanes

Similar Messages

  • Sql query union double rows

    Hi,
    i have a problem with my sql query.
    I need the difference from query 2 - query 1.
    the red marked row should be ignored because its already in table 1.
    Union compares all colums not just the first 3.
    Here's a screen of the problem:
    http://c60.img-up.net/?up=screenoracskt6.JPG
    thx for all

    Hi,
    Welcome to the forum!
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    Explain how you get those results from that data.
    Always say what version of oracle you're using.
    user6754335 wrote:
    Hi,
    i have a problem with my sql query.
    I need the difference from query 2 - query 1.
    the red marked row should be ignored because its already in table 1.
    Union compares all colums not just the first 3.That's right; UNION compare all the columns selected. If you're only interested in 3 of the columns, then only select those 3.
    If you need to display more columns, but not where all 3 of them match, then the best way is probably an outer join; but there are lots of other ways, including NOT EXISTS, NOT IN, and MINUS (in a sub-query).
    Here's a screen of the problem:
    http://c60.img-up.net/?up=screenoracskt6.JPG
    Post anything relevant on this site.

  • Double rows retrieved in a simple select

    Hi guys, I got an issue that I'm not able to resolve, maybe because I'm exauxted ( I moved more than 600 million of rows today)...anyway:
    create table ff (tote varchar, whe date, period int, added date, cost int)
    insert into ff values ('A', '2014-01-08', 1, '2014-01-06', 10),
    ('A', '2014-01-08', 1, '2014-01-07', 10),
    ('B', '2014-01-09', 1, '2014-01-06', 30),
    ('B', '2014-01-08', 1, '2014-01-07', 40)
    select tote, whe, period, MAX(added), cost
    from ff group by tote, whe, period, cost
    Having the code above I retrieve three rows.
    A 2014-01-08 1 2014-01-07 10
    B 2014-01-08 1 2014-01-07 40
    B 2014-01-09 1 2014-01-06 30
    That's why the cost is different in the tote B. It shouldn't be but with millions of rows you ran into a lot of these errors. The query above inside a procedure works fine ( Is one of the cte on cascade) but in one per cent of case doesn't works because
    retrieve the double rows ( as you can see works for the tote A but not for the tote B).
    Do you have any suggestion? I need to retrieve one rows per tote having the last added. I would like to avoid self join by the moment that the performance is slow...
    Thanks

    create table ff (tote varchar(10), whe date, period int, added date, cost int)
    insert into ff values ('A', '2014-01-08', 1, '2014-01-06', 10),
    ('A', '2014-01-08', 1, '2014-01-07', 10),
    ('B', '2014-01-09', 1, '2014-01-06', 30),
    ('B', '2014-01-08', 1, '2014-01-07', 40)
    ;with mycte as (select tote, whe, period, added , cost, row_number() Over(Partition by tote Order by added DESC) rn
    from ff )
    Select tote, whe, period, added , cost from mycte WHERE rn=1
    drop table ff

  • XML attributes makes my query return no rows

    Hello everyone,
    I've an odd problem.
    I'm querying some XML, but the attributes in one of the tags make my query return no rows; if I remove the attributes, then the query works as expected.
    The XML is below; it's the attributes in the Report tag that cause the issues:
    <result errorCode="0">
         <return>
              <Report
                   xsi:schemaLocation="Items_x0020_status_x0020_information http://******-****/ReportServer?%2FReports%2FContent%20Producer%20Reports%2FItems%20status%20information&amp;rs%3AFormat=xml&amp;rc%3ASchema=True"
                   Name="Items status information" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns="Items_x0020_status_x0020_information">
                   <Tablix1>
                        <Details_Collection>
                             <Details ItemId="914P7" Username="test" user_role="IT"
                                  first_name="Barry" last_name="Donovan" organisation=""
                                  content_format="On_Screen" modified_date="26/05/2011 13:16:49"
                                  item_status="Draft" status_date="" component_name="" demand="" />
                        </Details_Collection>
                   </Tablix1>
              </Report>
         </return>
    </result>My query is:
         select
                a.item_id
               ,a.username
               ,a.user_role
               ,a.first_name
               ,a.last_name
               ,a.supplier_id
               ,a.format
               ,a.modified_date
               ,a.item_status
               ,a.completion_date
               ,a.component_code
             from   dual
                   ,xmltable
                    ('/result/return/Report/Tablix1/Details_Collection/Details'
                       passing p_xml
                       columns
                          item_id         varchar2(1000) path '@ItemId'
                         ,username        varchar2(1000) path '@Username'
                         ,user_role       varchar2(1000) path '@user_role'
                         ,first_name      varchar2(1000) path '@first_name'
                         ,last_name       varchar2(1000) path '@last_name'
                         ,supplier_id     varchar2(1000) path '@organisation'
                         ,format          varchar2(1000) path '@content_format'
                         ,modified_date   varchar2(1000) path '@modified_date'
                         ,item_status     varchar2(1000) path '@item_status'
                         ,completion_date varchar2(1000) path '@status_date'
                         ,component_code  varchar2(1000) path '@demand'
                    ) a;I've tried stripping out the attributes in the tag, which does work, but some of the XML I'm expecting back may be quite large (many records), so that caused issues in itself. I'd rather deal with it and not mess with the XML itself if possible.
    Any help would be hugely appreciated!
    Thank you very much in advance.
    Robin
    Edited by: User_resU on Apr 12, 2012 2:50 PM

    Example:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select xmltype('<result errorCode="0">
      2     <return>
      3             <Report
      4                     xsi:schemaLocation="Items_x0020_status_x0020_information http://******-****/ReportServer?%2FReports%2FContent%20Producer%20Reports%2FItems%20status%20information&amp;rs%3AFormat=xml&amp;rc%3ASchema=True"
      5                     Name="Items status information" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      6                     xmlns="Items_x0020_status_x0020_information">
      7                     <Tablix1>
      8                             <Details_Collection>
      9                                     <Details ItemId="914P7" Username="test" user_role="IT"
    10                                             first_name="Barry" last_name="Donovan" organisation=""
    11                                             content_format="On_Screen" modified_date="26/05/2011 13:16:49"
    12                                             item_status="Draft" status_date="" component_name="" demand="" />
    13                             </Details_Collection>
    14                     </Tablix1>
    15             </Report>
    16     </return>
    17  </result>') as xml from dual)
    18  --
    19  -- end of test data
    20  --
    21       select
    22              a.item_id
    23             ,a.username
    24             ,a.user_role
    25             ,a.first_name
    26             ,a.last_name
    27             ,a.supplier_id
    28             ,a.format
    29             ,a.modified_date
    30             ,a.item_status
    31             ,a.completion_date
    32             ,a.component_code
    33           from   t
    34                 ,xmltable
    35                  (xmlnamespaces('Items_x0020_status_x0020_information' as "x0"),
    36                   '//x0:Report/x0:Tablix1/x0:Details_Collection/x0:Details'
    37                     passing xml
    38                     columns
    39                        item_id         varchar2(1000) path '@ItemId'
    40                       ,username        varchar2(1000) path '@Username'
    41                       ,user_role       varchar2(1000) path '@user_role'
    42                       ,first_name      varchar2(1000) path '@first_name'
    43                       ,last_name       varchar2(1000) path '@last_name'
    44                       ,supplier_id     varchar2(1000) path '@organisation'
    45                       ,format          varchar2(1000) path '@content_format'
    46                       ,modified_date   varchar2(1000) path '@modified_date'
    47                       ,item_status     varchar2(1000) path '@item_status'
    48                       ,completion_date varchar2(1000) path '@status_date'
    49                       ,component_code  varchar2(1000) path '@demand'
    50*                 ) a
    SQL> /
    ITEM_ID
    USERNAME
    USER_ROLE
    FIRST_NAME
    LAST_NAME
    SUPPLIER_ID
    FORMAT
    MODIFIED_DATE
    ITEM_STATUS
    COMPLETION_DATE
    COMPONENT_CODE
    914P7
    test
    IT
    Barry
    Donovan
    On_Screen
    26/05/2011 13:16:49
    Draft

  • WITH clause query:- Returns No Rows

    Hi,
    I am using the following query with, WITH clause, but some how it give "0 rows" returned,
    The underlying query does returns row when run in stand alone mode,
    With v_score_his_old
    As
    SELECT schs_run_date,schs_loc_shortcut_source,schs_lot_number,schs_facility_new,schs_facility_old, schs_operation_new,
    schs_operation_old,schs_route_new,schs_route_old,schs_product_new,schs_product_old,schs_owner_old,schs_intransit,
    schs_date,schs_transaction,schs_quantity_1_new,schs_quantity_1_old,/*0,*/schs_if_count_new,schs_if_count_old,
    schs_preprocessed,schs_consumed_quantity,/*'Y',*/schs_if_id,schs_if_id_old,fif_fac_loc_id
    FROM scm_score_his,full_item_facilities,location_params
    WHERE schs_state = 0
    AND fif_if_id = schs_if_id_old
    AND lopo_param_value = to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB', 'SITE_SORT')
    AND (schs_loc_shortcut_source = 'MP' OR schs_loc_shortcut_source = 'RE' OR schs_loc_shortcut_source = 'VI')
    UNION ALL
    SELECT schb_run_date,schb_loc_shortcut_source,schb_lot_number,schb_facility_new,schb_facility_old,schb_operation_new,
    schb_operation_old,schb_route_new,schb_route_old,schb_product_new,schb_product_old,schb_owner_old,schb_intransit,
    schb_date,schb_transaction,schb_quantity_1_new,schb_quantity_1_old,/*0,*/schb_if_count_new,schb_if_count_old,schb_preprocessed,
    schb_consumed_quantity,/*'Y',*/schb_if_id,schb_if_id_old,fif_fac_loc_id
    FROM scm_score_his_backups,full_item_facilities,location_params
    WHERE schb_state = 0
    AND fif_if_id = schb_if_id_old
    AND lopo_param_value = to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB', 'SITE_SORT')
    AND schb_date >= trunc(sysdate - 84)
    AND (schb_loc_shortcut_source = 'MP' OR schb_loc_shortcut_source = 'RE' OR schb_loc_shortcut_source = 'VI')
    Select schs_run_date,schs_loc_shortcut_source,schs_lot_number
    From v_score_his_old
    Where schs_loc_shortcut_source = 'MP';
    Oracle version is Oracle9i Enterprise Edition Release 9.2.0.6.0
    I am not able to get where I can going wrong.
    Please help me to understand this issue,
    Regards
    Umesh..

    With v_score_his_old
    As
    SELECT
    schs_run_date,schs_loc_shortcut_source,schs_lot_numbe
    ,schs_facility_new,schs_facility_old,
    schs_operation_new,
    chs_operation_old,schs_route_new,schs_route_old,schs_p
    roduct_new,schs_product_old,schs_owner_old,schs_intran
    sit,
    chs_date,schs_transaction,schs_quantity_1_new,schs_qua
    ntity_1_old,/*0,*/schs_if_count_new,schs_if_count_old,
    chs_preprocessed,schs_consumed_quantity,/*'Y',*/schs_i
    f_id,schs_if_id_old,fif_fac_loc_id
    FROM
    cm_score_his,full_item_facilities,location_params
    WHERE schs_state = 0
    AND fif_if_id = schs_if_id_old
    AND lopo_param_value =
    to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB',
    'SITE_SORT')
    AND (schs_loc_shortcut_source = 'MP' OR
    schs_loc_shortcut_source = 'RE' OR
    schs_loc_shortcut_source = 'VI')
    UNION ALL
    SELECT
    schb_run_date,schb_loc_shortcut_source,schb_lot_number
    ,schb_facility_new,schb_facility_old,schb_operation_ne
    w,
    chb_operation_old,schb_route_new,schb_route_old,schb_p
    roduct_new,schb_product_old,schb_owner_old,schb_intran
    sit,
    chb_date,schb_transaction,schb_quantity_1_new,schb_qua
    ntity_1_old,/*0,*/schb_if_count_new,schb_if_count_old,
    schb_preprocessed,
    chb_consumed_quantity,/*'Y',*/schb_if_id,schb_if_id_ol
    d,fif_fac_loc_id
    FROM
    cm_score_his_backups,full_item_facilities,location_par
    ams
    WHERE schb_state = 0
    AND fif_if_id = schb_if_id_old
    AND lopo_param_value =
    to_char(fif_site_id_fm)
    AND lopo_param_name IN ('SITE_FAB',
    'SITE_SORT')
    AND schb_date >= trunc(sysdate - 84)
    AND (schb_loc_shortcut_source = 'MP' OR
    schb_loc_shortcut_source = 'RE' OR
    schb_loc_shortcut_source = 'VI')
    ect
    schs_run_date,schs_loc_shortcut_source,schs_lot_number
    From v_score_his_old
    Where schs_loc_shortcut_source = 'MP';
    Hi!
    I've a doubt. If u finally picking all the values which matched with field schs_loc_shortcut_source and which is 'MP' - then why r u using multiple condition in the WITH part? So, in that case, u don't have to write that additional filtering of the following lines in the outer query -
    Where schs_loc_shortcut_source = 'MP';Regards.
    Satyaki De.

  • CR VS 2010 SQL query issue

    Hi all
    I'm facing a problem with my code.
    Dim cr As New CrystalReport1()
    Dim newCmd As SqlCommand
    Dim conn As SqlConnection
    Dim da As New SqlDataAdapter
    Dim ds As New DataSet
    Dim cr As New CrystalReport1
    Dim MyConnectionStr As String = "Data Source=MyDB;Initial catalog=MyCat;Integrated Security=true;" ' providerName=System.data.sqlClient"
    conn = New SqlConnection(MyConnectionStr)
    Dim cmdText As String
        cmdText= " SELECT customer.customer_name, customer.customer_tel, orders.order_stuff_name, orders.order_number" & _
    " FROM   hesabres.dbo.orders orders inner JOIN hesabres.dbo.customer customer ON orders.order_customer_id=customer.customer_id"
    da = New SqlDataAdapter(newCmd)
    da.fill(ds)
    cr.SetDataSource(ds.Tables(0))
    crystalviewer1.ReportSource = cr
    conn.Close()
      newCmd.Dispose()
    if i run the query, let's say it returns 2 rows
    I my CR veiwer, it shows 4 rows  (duplicates 2 x 2),
    if the query returns 3 rows, CR displays 9 rows (3 x 3) and so on 10 (10x10)....
    How is it possible??
    In my Dataset, the number of rows is always correct!
    Do you have any idea?
    Thanks in advance.
    B.

    See this wiki on how to troubleshoot issues with CR and datasets:
    Troubleshooting Issues with VS .NET Datasets and Crystal Reports - Business Intelligence (BusinessObjects) - SCN Wiki
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center
    Canada
    Follow us on Twitter

  • Physical query issued by Obiee when cache is on is different and slow

    When the same report runs in OBIEE 10g and cache is OFF it takes less then 1min to get results. If cache is turned ON physical query issued by Obiee is totally different and it takes 2h to get results. Has anyone experienced this with having cache on that some queries are performing poorly.
    Thanks,
    Tatjana

    We are using BI Apps Order Management and Fulfillment Analytics and all tables are cached anyway. Dimensions used are not that huge up to 40K rows. What should I check when it comes to DB query? As I said is different than one generated when cache is disabled although both have the almost the explain plan.

  • Return Code - Query for Multiple Rows as XML

    Hi,
    I'm executing an MSSQL stored procedure through the "Query for Multiple Rows as XML" activity in LiveCycle ES. I do this through a call statement such as this:
    { call MyStoredProc(?) }
    This works great, the stored procedure always returns a record set (with or without records). I use this activity rather than "Call Stored Procedure" because I can transform the record set into XML right away within this activity. Unfortunately any exception arising from invoking this stored procedure cannot be handled within the workflow as this activity does not have an exception handler (lightning bolt). In an attempt to handle at least some exceptions we have decided to use try/catches within the stored procedures and return different error codes. Now the problem I am faced with is that there is no way to retrieve the returned code within any of the SQL activities. We don't want to have to write an execute script for each of these SQL calls. Is there any way to do this? Seems like I'm 95% there.
    Thanks
    Nic

    Thanks for the offer, unfortunately we would need something certified by Adobe.
    Nic

  • Dataset query issues twice if the dataset is connected to matrix and used in multilookup function

    hello everybody.
    could not find any information if this is an intended behavior:
    dataset query issues twice if the dataset is connected to matrix and used in multilookup function
    parameters in both queries are the same
    ssrs: 2008 r2, sharepoint 2010 integrated
    sharepoint 2010: september 2014 cu
    thanks in advance
    Sergey Vdovin

    Hello, Wendy.
    I prepared a very empty sample report for you to demonstrate the problem - with this report, i hope, there is no place to discuss the shrinking of time data retrieval.
    There is one dataset, one parameter and one lookup function. The query is executed twice.
    <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
    <AutoRefresh>0</AutoRefresh>
    <DataSources>
    <DataSource Name="DataSource1">
    <DataSourceReference>http://t005/ProjectBICenter/DocLib/IntegrationDBVdovin.rsds</DataSourceReference>
    <rd:SecurityType>None</rd:SecurityType>
    <rd:DataSourceID>7e554344-d6c2-48a5-a7f4-1d24608cb4b5</rd:DataSourceID>
    </DataSource>
    </DataSources>
    <DataSets>
    <DataSet Name="DataSet1">
    <Query>
    <DataSourceName>DataSource1</DataSourceName>
    <CommandText>select 1 as temp, '$' as tempname</CommandText>
    <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
    </Query>
    <Fields>
    <Field Name="temp">
    <DataField>temp</DataField>
    <rd:TypeName>System.Int32</rd:TypeName>
    </Field>
    <Field Name="tempname">
    <DataField>tempname</DataField>
    <rd:TypeName>System.String</rd:TypeName>
    </Field>
    </Fields>
    </DataSet>
    </DataSets>
    <ReportSections>
    <ReportSection>
    <Body>
    <ReportItems>
    <Textbox Name="ReportTitle">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Lookup(1,Fields!temp.Value,Fields!tempname.Value,"DataSet1")</Value>
    <Style>
    <FontFamily>Verdana</FontFamily>
    <FontSize>20pt</FontSize>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:WatermarkTextbox>Title</rd:WatermarkTextbox>
    <rd:DefaultName>ReportTitle</rd:DefaultName>
    <Top>0mm</Top>
    <Height>10.16mm</Height>
    <Width>139.7mm</Width>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </ReportItems>
    <Height>57.15mm</Height>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    </Style>
    </Body>
    <Width>152.4mm</Width>
    <Page>
    <PageFooter>
    <Height>11.43mm</Height>
    <PrintOnFirstPage>true</PrintOnFirstPage>
    <PrintOnLastPage>true</PrintOnLastPage>
    <Style>
    <Border>
    <Style>None</Style>
    </Border>
    </Style>
    </PageFooter>
    <PageHeight>29.7cm</PageHeight>
    <PageWidth>21cm</PageWidth>
    <LeftMargin>2cm</LeftMargin>
    <RightMargin>2cm</RightMargin>
    <TopMargin>2cm</TopMargin>
    <BottomMargin>2cm</BottomMargin>
    <ColumnSpacing>0.13cm</ColumnSpacing>
    <Style />
    </Page>
    </ReportSection>
    </ReportSections>
    <ReportParameters>
    <ReportParameter Name="ReportParameter1">
    <DataType>String</DataType>
    <DefaultValue>
    <Values>
    <Value>1</Value>
    </Values>
    </DefaultValue>
    <Prompt>ReportParameter1</Prompt>
    <ValidValues>
    <DataSetReference>
    <DataSetName>DataSet1</DataSetName>
    <ValueField>temp</ValueField>
    <LabelField>tempname</LabelField>
    </DataSetReference>
    </ValidValues>
    </ReportParameter>
    </ReportParameters>
    <rd:ReportUnitType>Mm</rd:ReportUnitType>
    <rd:ReportServerUrl>http://t005/ProjectBICenter</rd:ReportServerUrl>
    <rd:ReportID>cd1262ef-eca7-4739-a2ce-d3ca832d5cd6</rd:ReportID>
    </Report>
    Sergey Vdovin

  • MDX query issue - get key instead of text

    Hello,
    My BW query contain single row of type 0FUNDS_CTR that should be display key and not text. When query is running from query designer I can see the key in the results.
    But, when I try to get the results of MDX statemet on this query I see the text of 0FUNDS_CTR instead of key!
    My query is:
    SELECT NON EMPTY [[Measures]].MEMBER ON AXIS(0),
    NON EMPTY [[0FUNDS_CTR]].MEMBERS ON AXIS(1) FROM
    [[MY_CUBE_NAME/MY_QUERY_NAME]]
    CELL PROPERTIES CELL_ORDINAL, VALUE, FORMATTED_VALUE
    I try to replace VALUE to KEY in
    "CELL PROPERTIES CELL_ORDINAL, VALUE, FORMATTED_VALUE" query part and even remove this declaration but there is no effect.
    I need to work with MDX statements like this and run them from with BI SDK XMLA Connector.
    Any idea?
    Thanks,
    Ola
    Edited by: Ola Agiv on Jul 30, 2008 10:05 AM
    Edited by: Ola Agiv on Jul 30, 2008 10:06 AM

    Hi Ola,
    Regarding your case ..
    Could you try to go to your query using ur query designer, then go to 0FUNDS_CTR property.
    Set the attribute display as to be KEY.
    And run again your MDX.
    See the result, whether it change into your expectation / not ??
    Hopefully it can help you a lot.
    Regards,
    Niel.

  • Query to convert Row to column - Re-posting

    Hi all,
    i am re-posting the same requirement, please do the needful.
    I need a query to convert row value into column delimited by ','
    create table tb_row_2_col (id number,val varchar2(100));
    insert into tb_row_2_col values (1,'col1');
    insert into tb_row_2_col values (1,'col2');
    insert into tb_row_2_col values (1,'col3');
    insert into tb_row_2_col values (2,'col4');
    insert into tb_row_2_col values (2,'col5');
    commit;
    SQL> select * from tb_row_2_col;
    ID VAL
    1 col1
    1 col2
    1 col3
    2 col4
    2 col5
    SQL>
    if i execute a query the output should be like this
    ID VAL
    1 col1,col2,col3
    2 col4,col5
    Thanks in advance
    S. Sathish Kumar

    Most repeated question in the forum..
    SQL> select id,max(ltrim(sys_connect_by_path(val,','),',')) res
      2  from (select id,val,
      3           row_number() over(partition by id order by val) rn
      4        from tb_row_2_col)
      5  start with rn = 1
      6  connect by prior rn = rn -1
      7          and prior id = id
      8  group by id;
            ID RES
             1 col1,col2,col3
             2 col4,col5<br>
    Message was edited by:
    jeneesh
    Check here for variations..

  • Query to convert Row to column

    Hi all,
    I need a query to convert row value into column delimited by ','
    create table tb_row_2_col (id number,val varchar2(100));
    insert into tb_row_2_col values (1,'col1');
    insert into tb_row_2_col values (1,'col2');
    insert into tb_row_2_col values (1,'col3');
    insert into tb_row_2_col values (2,'col4');
    insert into tb_row_2_col values (2,'col5');
    commit;
    SQL> select * from tb_row_2_col;
    ID VAL
    1 col1
    1 col2
    1 col3
    2 col4
    2 col5
    SQL>
    if i execute a query the output should be like this
    ID VAL
    1 col1,col2,col3
    2 col4,col5
    Thanks in advance
    S. Sathish Kumar

    Or look for aggregation techniques against the forum helping by the search feature (top-right of the current page).
    Nicolas.

  • 3.5 Query Designer has 'row' in the footer of results but 7.0 has 'page'

    3.5 Query Designer has 'row' in the footer of results but 7.0 has 'page' is there a way to change 7.0 to have 'row' instead of 'page'? We would prefer to see how many rows of data we have. I didn't know if this was a parameter they may be able to be changed.
    Thanks,
    Diane

    I donot think there is way to display Row instead of Page.
    Also in 7.0. It is based on cells.

  • Web Query issues

    Hi All,
    I have created a web query and assigned it to a role. I have moved the role, web templete and the query from dev to QA was able run the query fine without issues.
    The problem I am having is when I make changes to the query and transport it to QA...when I run the query from the role menu it still shows the old query instead of the changed query.
    Can someone please explain what are the steps I need to take when I make changes to exsisting web query in dev and move to QA and be able to see the changes. What are all the objects I need to collect. Also would like to know if there are any settings on the role menu or web templete that need to be changed and also any buffers that I need to cleared??
    Any help is appriciated and will give max points.
    Thanks

    BWdesi,
    please avoid reposts - it could be that due to network issues the post got posted twice... close one of them as answered and then proceed with the other one...
    Web Query issues
    Arun

  • Query issue

    I had query issue on planning layout
    Sold    mat   price   qty   amount
    100      3        5        5          25    layout 1
    100      4       10       5          50    layout2
    when I should removed  material  cal has to come  like this
    100             15        10          75
    but I getting value like
    100        15       10       150
    can u plz tell me how to slove this
    regards
    raju

    Dear Raju,
    In the query, for the Calculated Key Figure (Amount)
       Select properties, enhanced and change to:
                          "BEFORE AGGREGATION"
    It seems to be doing after aggregation, which is  default.
    it is aggregating:
        price = 5+10 = 15
        qty   = 5+5 = 10
        Amount = 15 * 10 = 150
    Good luck, BB

Maybe you are looking for

  • Help plz-internalFrames--buttons-video..any jgurus around??

    Hi to all My name is Dimitrios and i am developing a program which is consisted by a client program and a server program. The purpose of the application is to stream video (TV channels) to the client.The server program is used to authenticate the cli

  • Illustrator won't open clipboard

    When I open illustrator and click new file it brings me to the new file prompt and after selecting ok, nothing opens? When I try to open a file it says it's open I just can't see see the clipboard. How can I resolve this?

  • Guest WLAN and IP Address Exhaustion

    Does anybody know of a way to stop a DHCP Server from doling out IP addresses (and subsequently exhausting the DHCP Scope) prior to performing L3 Web Auth to the WLC? The problem arises when Students come into School with their iPhones and such like

  • XSQL Hello World

    I am working with IE5 8i and Java Web Srvr 2.0 I have done followings.. 1. set classpath for 4,5 jars 2. added oracle servlet to JWS 3. added servelet aliases 4. configured xmlconfig for local database when i call http://hostname:9090/examples/test.x

  • Case structure no false output

    Hey guys, To start off, I am very new at Labview.  I have posted about this project before but my professor has changed the assignment slightly. - Generate a random set of N points (x,y) between 0 and 100 - Find the closest point to each point - Calc