Display Distinct Values

Hello Gurus,
I have a table with 3 Cols No , Id , Name where ( No , ID ) is a compsite key and the data looks like this
No , Id , Name
1 2 A
1 3 B
1 4 C
i want a SQL Query which displays data like this
No Id Name
1 2 A
3 B
4 C
Help will be really appreciated
Thanks in advance
Ths

Take a look at your results. Is that really how you want it?
Or did you forget to use tags to preserve the spacing?
Instructions here: http://forums.oracle.com/forums/help.jspa                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Display Distinct values in LightSwitch browse screen

    i have one browse screen which is fetching value from one entity(Attached to SQL datasource), the entity will look like the below snapshot.
    ID
    EMP ID
    Emp Name
    Age
    Role
    1
    266
    Srikanth
    26
    Developer
    2
    266
    Srikanth
    26
    Architect
    3
    122
    Raj
    29
    Tester
    4
    122
    Raj
    29
    Manager
    So in the browse screen its coming with all row values (1,2,3 and 4) even though i removed the Role field from the screen. I want to display only the distinct Emp ID, Name, Age in the browse screen of this entity. Please
    give me some suggestion.

    i suggest to Create new View Return Only Distinct record from Original Table And Update your DataSource with this view And Create Your Browse Screen Depends on This View
    SQL Script
    Create View VwEmployeeDistenct
     as 
    select Distinct  [EMP ID], [Emp Name],
    [Age]  from OrginalEmplyeeTable 
    go

  • Distinct values in each column

    Hi
    I have a table with three columns and I would like to display distinct values in each column. Could any one please help me to get the output.
    col1     col2     col3
    ====     ====     ====
    a     1     x     
    a     2     y
    a     3      z
    a     4      u
    b     5      v
    b     6      x
    b     7      x
    b     9      x
    b     10     y
    b     11     y
    b     12     y
    b     13     y
    b     14     x
    b     15     y
    b     16     z
    b     17     u
    b     18     v
    b     19     x
    b     20     x
    c     21     x
    c     22     y
    c     23     y
    c     24     y
    c     25     y
    c     26     x
    c     27     y
    c     28     z
    Output needed
    ===========
    col1     col2     col3
    ====     ====     ====
    a     1     x
    b     2     y
    c     3     z
         4     u
         5     v
         6
         7
         9
         10
         11
         12
         13
         14
         15
         16
         17
         18
         19
         20
         21
         22
         23
         24
         25
         26
         27
         28
    Thanks
    Vasanth

    but the only drawback - you need to know the column, comprising the biggest amount of distinct values beforehand.No. There is no any difference in which column will be chosen as "based".
    For demo purposes I've added extra row number column to show full generality and symmetry of the approach:
    exec dbms_random.seed(0)
    with t as ( select chr(ascii('a') + dbms_random.value(0, 3)) as c1,
                       trunc(dbms_random.value(1, 20))           as c2,
                       chr(ascii('u') + dbms_random.value(0, 6)) as c3
                  from dual connect by level <= 20
       tt1 as ( select lag(          null,  1, c1) over (partition by c1 order by null) as c1,
                       lag(to_number(null), 1, c2) over (partition by c2 order by null) as c2,
                       lag(          null,  1, c3) over (partition by c3 order by null) as c3
                  from t
       tt2 as ( select tt1.*,
                       row_number() over (order by c1) as rn1,
                       row_number() over (order by c2) as rn2,
                       row_number() over (order by c3) as rn3,
                       rownum rn
                  from tt1
       tt3 as ( select case when rn1 > rn
                            then last_value(c1) over (order by rn1 range between abs(rn1 - rn) preceding
                                                                             and abs(rn1 - rn) preceding)
                            else last_value(c1) over (order by rn1 range between abs(rn - rn1) following
                                                                             and abs(rn - rn1) following)
                       end as c1,
                       case when rn2 > rn
                            then last_value(c2) over (order by rn2 range between abs(rn2 - rn) preceding
                                                                             and abs(rn2 - rn) preceding)
                            else last_value(c2) over (order by rn2 range between abs(rn - rn2) following
                                                                             and abs(rn - rn2) following)
                       end as c2,
                       case when rn3 > rn
                            then last_value(c3) over (order by rn3 range between abs(rn3 - rn) preceding
                                                                             and abs(rn3 - rn) preceding)
                            else last_value(c3) over (order by rn3 range between abs(rn - rn3) following
                                                                             and abs(rn - rn3) following)
                       end as c3
                  from tt2
    select c1, c2, c3 from tt3
      where c1 || c2 || c3 is not null
      order by c1, c2, c3
    C1            C2 C3
    a              1 u
    b              3 v
    c              4 w
                   5 x
                   7 y
                   8 z
                   9
                  11
                  13
                  15
                  16
                  17
                  19
    13 rows selected.P.S. Thanks to [url http://www.sql.ru/forum/actualthread.aspx?bid=3&tid=482506&hl=over+range#4785373]Vladimir Sitnikov for the demo of the approach.

  • How to get distinct values from a list and display in a ListView webpart.

    Hi,
    I have a requirement in which I need to pull unique/distinct values from a custom list and then display it via a listview webpart. Can any one suggest how this can be done.
    If possible please share the CAMEL query to fetch distinct values from a custom list.
    Thanks,
    Ankit

    Hi Ankit,
    Is there any particular reason that the values need to be shown in a list view web part?  Are you going to use that web part for filtering via web part connections?
    I ask because the enterprise site collection features include the SharePoint List Filter web part, which may accomplish what you're looking for.
    If you just need to display the values in a grid view, you might have more luck with the JavaScript Client Object Model.  Try putting the following in a text file:
    <style>
    .CustomTableClass{display:table;table-layout:fixed}
    .CustomRowClass{display:table-row;}
    </style>
    <div id="distinct_values_div" class="CustomTableClass">
    <img src="/_layouts/loading.gif" />
    </div>
    <script language="JavaScript" type="text/JavaScript">
    var siteUrl = '/sitecollection/web'; //use the actual subsite URL here
    var listName = 'mylist'; // use the actual list name here
    var field = "Title" // use the actual field you want to display here
    var divToUpdate = document.getElementById("distinct_values_div");
    var rowClass = "CustomRowClass";
    ExecuteOrDelayUntilScriptLoaded(function(){
    var clientContext = new SP.ClientContext(siteUrl);
    var web = clientContext.get_web();
    var lists = web.get_lists();
    var list = lists.getByTitle(listName);
    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml('<View><Query></Query><RowLimit>500</RowLimit></View>');
    this.collListItem = list.getItems(camlQuery);
    clientContext.load(collListItem,"Include ("+field+")");
    clientContext.executeQueryAsync(
    Function.createDelegate(this, this.onQuerySucceeded),
    Function.createDelegate(this, this.onQueryFailed));
    },"sp.js");
    function onQueryFailed(sender, args){
    divToUpdate.innerHTML = 'Unable to retrieve values: '+args.get_message());
    function onQuerySucceeded(sender, args){
    var allValues = [];
    var listItemEnumerator = collListItem.getEnumerator();
    divToUpdate.innerHTML = "";
    while(listItemEnumerator.moveNext()){
    var listItem = listItemEnumerator.get_current();
    if(!containsString(allValues,listItem.get_item(field)){
    var value = listItem.get_item(field);
    allValues.push(value);
    var newDiv = document.createElement("div");
    newDiv.className = rowClass;
    newDiv.innerHTML = value;
    divToUpdate.appendChild(newDiv);
    function containsString(strArray, text){
    var contains = false;
    for (var i=0; i<strArray.length; i++){
    if(strArray[i]==text){contains = true; break;}
    return contains;
    </script>
    Upload the text file to a library on the site, then add a content editor web part to a page where you want the distinct values to appear. In the content editor web part's properties, edit the Content Link so that it links directly to the text file.  This
    will cause the JavaScript to run on the page.

  • How to display all distinct values without duplicates.

    Hi Pros,
          I want to present a values list in dashboard, but this list have much duplicates, so when dispalying, I want to display all distinct values without duplicates.

    Hi,
    You can avoid the duplicates from the source side or use a filtered row option in the component.
    Arun

  • Display Distinct Item Value

    Hello All,
    I am having an problem displaying a distinct value for Item 'PK_EMPL_ID'. I need all the Items below because I am passing these values to another page in APEX. But I need help with this select statement syntax.
    SELECT hs.pk_session_id,
           hsp.pk_session_process_id,
           hs.fk_class_id,
           hsm.pk_empl_id,
           hsm.last_name || ', ' || hsm.first_name studentname,
           dg.department_group_descr,
           pd.department_descr,
           hsm.fk_dept_group,
           hsm.fk_dept_code,
           hsp.fk_empl_id,
           hs.session_meridiem,
           hsn.session_name,
           hs.session_date,
           hsp.session_process_status
        FROM   hrt_session hs,
               hrt_session_name hsn,
               hrt_session_process hsp,
               hrt_student_master hsm,
               cobr.department_group dg,
               cobr.pps_department pd
        WHERE  hsn.pk_session_name_id = hs.fk_session_name_id
           AND hsp.fk_session_id = hs.pk_session_id
           AND hsp.fk_empl_id = hsm.pk_empl_id
           AND hsm.fk_dept_group = dg.pk_department_group_id
           AND hsm.fk_dept_code = pd.pk_department_idMy output is like:
    -PK_EMPL_ID-
    JOHN
    JOHN
    JOHN
    BOBBY
    JAMES
    I only want to display each 'PK_EMPL_ID' value once when the select statement is executed, not duplicate values. I have tried distinct, group by etc... but I am having trouble since I am using multiple tables using these foreign keys. I have viewed a few threads but they are only handling one or two item values from one table. Can anyone assist me with please? Thanks ahead of time.

    Hi,
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements) for all tables, and the results uyou want from that data.
    You may have a clear idea of where you're coming from, and where you want to go, but the description alone doesn't convey that clear idea to us.
    You can also rephrase your question in terms of some commonly available table, like scott.emp.
    For example: "I'm doing this query on scott.emp:
    {code}
    SELECT      job
    ,     deptno
    FROM     scott.emp
    {code}
    How can I get only 1 row per distinct job?"
    Without sample output, the question is still vague.
    There are 14 rows in scott.emp.
    You can reduce the output to 9 rows by changing "SELECT" to "SELECT *DISTINCT* ":
    SELECT DISTINCT
         job
    ,     deptno
    FROM     scott.emp
    ;which produces:
    OB           DEPTNO
    MANAGER           20
    PRESIDENT         10
    CLERK             10
    SALESMAN          30
    ANALYST           20
    MANAGER           30
    MANAGER           10
    CLERK             30
    CLERK             20But that's as far as you can go without changing the results.
    For example, all three departments have MANAGERs. If you want only 5 rows of outptu (one for each of the 5 distinct jobs), then which deptno do you want?
    If you want the lowest one, here's one way to do that:
    WITH     got_rnum     AS
         SELECT     job
         ,     deptno
         ,     ROW_NUMBER () OVER ( PARTITION BY  job
                                   ORDER BY          deptno
                           ) AS rnum
         FROM    scott.emp
    SELECT     job
    ,     deptno
    FROM     got_rnum
    WHERE     rnum     = 1
    ;Output:
    JOB           DEPTNO
    ANALYST           20
    CLERK             10
    MANAGER           10
    PRESIDENT         10
    SALESMAN          30There are other apprioaches to this problem, too. The advantage of this one is that it works well with any number of columns in the output.

  • "How to get distinct values of sharepoint column using SSRS"

    Hi,
        I have integrated sharepoint list data to SQL Server reporting services. I am using the below to query sharepoint list data using sql reporting services.
    <Query>
       <SoapAction>http://schemas.microsoft.com/sharepoint/soap/GetListItems</SoapAction>
       <Method Namespace="http://schemas.microsoft.com/sharepoint/soap/" Name="GetListItems">
          <Parameters>
             <Parameter Name="listName">
                <DefaultValue>{GUID of list}</DefaultValue>
             </Parameter>
             <Parameter Name="viewName">
                <DefaultValue>{GUID of listview}</DefaultValue>
             </Parameter>
             <Parameter Name="rowLimit">
                <DefaultValue>9999</DefaultValue>
             </Parameter>           
          </Parameters>
       </Method>  
    <ElementPath IgnoreNamespaces="True">*</ElementPath>
    </Query>
    By using this query, I am getting a dataset which includes all the columns of sharepoint list. Among these columns, I wanted to display only 2 columns (i.e Region and Sales type) using chart. I have created a Region parameter but when I click preview, the drop down box is giving me all the repeatative values of region like RG1,RG1,RG1,RG2,RG2,RG2,RG2,RG3.......... I wanted to display only distinct values of Region parameter so that whenever end user select region from the parameter drop down, it will display the respective value of Sales type column.
    Also when I select only RG1 parameter, it is giving me a chart including the sales type of all the Regions. (it should display me only the sales type of RG1) How can I link these 2 columns so that they will display the values respectively.
              I would really appreciate if anyone can help me out with this.
    Thanks,
    Sam.

    Hi Sam,
    By code, the CAML language doesn’t have any reserved word (or tag) to set this particular filter to remove duplicate results.
    In this case, we could use the custom code to get distinct records.
    Here are the detailed steps:
    1.         Create a hidden parameter that gets all the records in one field.
    Note: Please create another dataset that is same of the main dataset. This dataset is used for the parameter.
    2.         Create a function that used to remove the duplicate records.
    Here is the code:
    Public Shared Function RemoveDups(ByVal items As String) As String
    Dim noDups As New System.Collections.ArrayList()
    Dim SpStr
    SpStr = Split(items ,",")
    For i As Integer=0 To Ubound(Spstr)
    If Not noDups.Contains(SpStr(i).Trim()) Then
    noDups.Add(SpStr(i).Trim())
    End If
    Next
    Dim uniqueItems As String() = New String(noDups.Count-1){}
    noDups.CopyTo(uniqueItems)
    Return String.Join(",", uniqueItems)
    End Function
    3.         Create another parameter that will be used for filtering the maindata.
    Please set the available value to be =Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",")
    And the default value to be the value you what such as the first value:
    =Split(Code.RemoveDups(JOIN(Parameters!ISSUE_STATUS_TEMP.Value, ",")), ",").(0)
    4.         Go to the main dataset. Open the property window of this dataset.
    5.         In the “Filters” tab, set the filter to be:
    Expression: <The field to be filter>
    Operator: =
    Value: =Parameters!Region.Value
    The parameter “Region” should be the parameter we created in the step3.
    Now, we should get distinct values of SharePoint columns.
    If there is anything unclear, please feel free to ask.
    Thanks,
    Jin
    Jin Chen - MSFT

  • How to display the values stored in the database in the combobox on load?

    I am develping one application where in
    I wanted to display the values in the combobox which I am taking from the database and in the same form passing that value in same form after selecting it,My program is running fine for the first time but next time it is giving me NullPointerException.
    So can anyone tell me please how I should develop the this application to avoid this exception?
    Thank You
    Praddy

    Thanx a lot for showing interest in answering my query.I am pasting my code for ur reference.Please try to reply ASAP.
    Thank You,
    Praddy.
    CODE:
    ======
    <html>
    <head>
         <script language="javascript">
              function submitthisform(thisForm)
                   thisForm.submit();                    
         </script>
    </head>
    <body>
    <form method=post name=samepgm>
    Select City:     <select name=city onChange='submitthisform(samepgm)'><br><br><br>
    <option value=''></option>
    <option value='All'>All</option>
    <%@ page language="java" import="java.sql.*" %>
    <%
              String scity = request.getParameter("city");
              System.out.println(scity);
              Connection con = null;
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con = DriverManager.getConnection("jdbc:odbc:property","","");
              Statement st = con.createStatement();          
              ResultSet rs1 = st.executeQuery("select distinct hcity from housefinance");
              while(rs1.next())
                   //String ohname = rs1.getString("hname");     
                   String     ocity = rs1.getString("hcity");     
                   //out.println(ohname +"<br>");
                   out.println(ocity +"<br>");
    %>
    <br><br><br><option value='<%=ocity%>'><%=ocity%></option><br>
    <%               }
                   rs1.close();
              if(scity.equals("All"))
              ResultSet rs2 = st.executeQuery("select * from housefinance");      
              while(rs2.next())
                   String     ohname = rs2.getString("hname");     
                   String     ohadd1 = rs2.getString("hadd1");
                   //String ohadd2 = rs2.getString("hadd2");
                   String     ohcity = rs2.getString("hcity");
                   String     ohpcode = rs2.getString("hpcode");
                   String     ohtelno = rs2.getString("htelno");
                   String     ohfaxno = rs2.getString("hfaxno");
                   String     ohemail = rs2.getString("hemail");
                   String     ohmobile = rs2.getString("hmobile");     
    %>
    <pre>
    <tr>
    <td><p>Company          :     <%=ohname%> </p></td>
    <td><p>Address          :     <%=ohadd1%></p></td>
    <td><p>City          :     <%=ohcity%> </p></td>
    <td><p>Pin          :     <%=ohpcode%></p></td>
    <td><p>Telphone          :     <%=ohtelno%></p></td>
    <td><p>Fax No:          :     <%=ohfaxno%></p></td>
    <td><p>Email          :     <%=ohemail%></p></td>
    <td><p>Mobile No.     :     <%=ohmobile%></p></td>
    </tr>
    </pre>
    <%
              else
    ResultSet rs = st.executeQuery("select * from housefinance where hcity like '%"+scity+"%'");
              while(rs.next())
                   String     ohname = rs.getString("hname");     
                   String     ohadd1 = rs.getString("hadd1");
                   //String ohadd2 = rs.getString("hadd2");
                   String     ohcity = rs.getString("hcity");
                   String     ohpcode = rs.getString("hpcode");
                   String     ohtelno = rs.getString("htelno");
                   String     ohfaxno = rs.getString("hfaxno");
                   String     ohemail = rs.getString("hemail");
                   String     ohmobile = rs.getString("hmobile");     
    %>
    <tr>
    <td><p>Company          :     <%=ohname%> </p></td>
    <td><p>Address          :     <%=ohadd1%></p></td>
    <td><p>City          :     <%=ohcity%> </p></td>
    <td><p>Pin          :     <%=ohpcode%></p></td>
    <td><p>Telphone          :     <%=ohtelno%></p></td>
    <td><p>Fax No:          :     <%=ohfaxno%></p></td>
    <td><p>Email          :     <%=ohemail%></p></td>
    <td><p>Mobile No.     :     <%=ohmobile%></p></td>
    </tr>
    <hr>
    <%               }
    %>
    </select>
    </form>
    </body>
    </html>

  • Null Error in Displaying a value through view attribute

    I just want to display a value through message styled text bean from view attribute .
    For that i use the code in PR:
    But it gives null error: Please any one help me.
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("StaffInfoVO1");
    if(vo!=null)
    OARow row = (OARow)vo.getCurrentRow();
    System.out.println("vo is not null");
    String str1 = row.getAttribute("FullName").toString();
    OAMessageStyledTextBean stext1 = (OAMessageStyledTextBean)webBean.findChildRecursive("RFStaffName");
    stext1.setText(str1);
    While getattribute("FullName") executed it gives null error. Why?
    how to rectify?

    Hai,
    I can execute the query in toad which returns 1 row of data. It is not null rows.
    But my vo object, why it is not executed. Returning null. I dont know.. Too many hours i spent.
    VO query:
    select distinct papf.person_id,papf.FULL_NAME,
    papf.EMPLOYEE_NUMBER,
    papf.EMAIL_ADDRESS,
    papf.WORK_TELEPHONE,
    hla.COUNTRY,
    sysdate,
    pap.NAME,
    haou.NAMe department,
    ood.ORGANIZATION_NAME
    from
    per_all_people_f papf,
    per_all_assignments_f paaf,
    per_all_positions pap,
    per_jobs pj,
    per_grades pg,
    per_person_types ppt,
    hr_all_organization_units haou,
    hr_locations_all hla,
    org_organization_definitions ood
    where
    papf.PERSON_TYPE_ID=ppt.PERSON_TYPE_ID and
    papf.PERSON_ID=paaf.PERSON_ID and
    paaf.POSITION_ID=pap.POSITION_ID and
    paaf.JOB_ID=pj.JOB_ID and
    paaf.BUSINESS_GROUP_ID=haou.BUSINESS_GROUP_ID and
    papf.person_type_id=13 and
    haou.business_group_id=202 and
    haou.NAME like '%Global%Sales%' and
    papf.FULL_NAME like '%Stand%' and
    paaf.LOCATION_ID=hla.LOCATION_ID and
    paaf.ORGANIZATION_ID=ood.ORGANIZATION_ID and
    sysdate between papf.EFFECTIVE_START_DATE and papf.EFFECTIVE_END_DATE and
    sysdate between paaf.EFFECTIVE_START_DATE and paaf.EFFECTIVE_END_DATE
    Help Me.
    Thanks & Regards

  • XSL - distinct-values

    Hi Vlad,
    I am encountering a problem with the xsl transform, if a value in the input xml is same in same/multiple orders, the unique values gets appended in the same node, in the below example, I have an order with SKU "2" with Qty "1" and SKU "4" with Qty "2", so, my csv file will come with 3 lines, 1 line for SKU "2" and 2 lines for SKU4. The output seems to append both the distinct values (like <ns0:quantity_ordered>*1 2*</ns0:quantity_ordered>) in the same node as shown in the example below. I don't know whether I am using a wrong key in the Item_Data or something else,
    I believe, I am not using the right condition to check for the distinct SKU or using a wron for-each condition, I am not sure if that is the problem. I would appreciate if you could point me to the problem.
    Thanks,
    Venkatesh

    Hi Vlad,
    That was really helpful. Thank You!
    I think this one is almost done except for one particular scenario, where, an order has a duplicate of same SKU (different qty), only one SKU is displayed under Item_data node.
    For example,
    Order 1001 has SKU 1 with Qty of 1 and a duplicate of the same SKU with Qty as 2, In this case, only the first SKU is used and the second one with the Qty 2 gets ignored.
    Order# SKU QTY
    1001 1 1
    1001 1 2
    The input xml would be
    <DailySummary>
         <OrderDetails>
                 <PurchaseOrderNumber>1001</PurchaseOrderNumber>
                 <SKU>1</SKU>
                 <Qty>1</Qty>
         <OrderDetails>
         <OrderDetails>
                 <PurchaseOrderNumber>1001</PurchaseOrderNumber>
                 <SKU>1</SKU>
                 <Qty>2</Qty>
         <OrderDetails>
    <DailySummary>The expected output is,
    <ns2:item_Data>
                <ns0:vendor_item_number>1</ns0:vendor_item_number> (SKU)
                <ns0:quantity_ordered>1</ns0:quantity_ordered> (QTY)
                <ns0:quantity_shipped>1</ns0:quantity_shipped>
                <ns0:unit_cost>1</ns0:unit_cost>
                <ns0:extended_cost>1</ns0:extended_cost>
             </ns2:item_Data>
             <ns2:item_Data>
                <ns0:vendor_item_number>1</ns0:vendor_item_number> (SKU)
                <ns0:quantity_ordered>2</ns0:quantity_ordered> (QTY)
                <ns0:quantity_shipped>2</ns0:quantity_shipped>
                <ns0:unit_cost>1</ns0:unit_cost>
                <ns0:extended_cost>2</ns0:extended_cost>
             </ns2:item_Data>
          </ns1:order>The XSL used to transform is shown below, There is a for each distinct-values for the SKU, can the 'for each' be combined to check for SKU and Qty?, so that for an order if SKU is distinct and Qty is not then take both SKU's and appropriate qty.
                <xsl:for-each select="fn:distinct-values(/tns:DailySummary/tns:OrderDetails[tns:PurchaseOrderNumber = $tmpOrdNo]/tns:SKU/text())">
                  <xsl:variable name="tmpSKU" select="."/>
                  <ns2:item_Data>
                    <ns0:vendor_item_number>
                      <xsl:value-of select="/tns:DailySummary/tns:OrderDetails[tns:PurchaseOrderNumber = $tmpOrdNo and tns:SKU = $tmpSKU][1]/tns:SKU"/>
                    </ns0:vendor_item_number>
                    <ns0:quantity_ordered>
                      <xsl:value-of select="/tns:DailySummary/tns:OrderDetails[tns:PurchaseOrderNumber = $tmpOrdNo and tns:SKU = $tmpSKU][1]/tns:QtyOrdered"/>
                    </ns0:quantity_ordered>
                    <ns0:quantity_shipped>
                      <xsl:value-of select="/tns:DailySummary/tns:OrderDetails[tns:PurchaseOrderNumber = $tmpOrdNo and tns:SKU = $tmpSKU][1]/tns:QtyShipped"/>
                    </ns0:quantity_shipped>
                    <ns0:unit_cost>
                      <xsl:value-of select="/tns:DailySummary/tns:OrderDetails[tns:PurchaseOrderNumber = $tmpOrdNo and tns:SKU = $tmpSKU][1]/tns:Price"/>
                    </ns0:unit_cost>
                    <ns0:extended_cost>
                      <xsl:value-of select="/tns:DailySummary/tns:OrderDetails[tns:PurchaseOrderNumber = $tmpOrdNo and tns:SKU = $tmpSKU][1]/tns:Net"/>
                    </ns0:extended_cost>
                  </ns2:item_Data>
               </xsl:for-each>
               I appreciate all your help,
    Thanks,
    Venkatesh

  • Count distinct values in report builder

    i have a situation where i have to count distinct number of customers.
    i have a query which returns the list of values of bill_to_customer_id from ra_customer_trx_all table and i have to display only the number of distinct customers. i cant do this in the query because it has to be grouped and i am doing it in an aging report. i have to list the number of distinct customers in each aging period. can anybody please help me how to achieve this in reports 6i.
    thanks

    how can i count distinct values in reports?
    the situation is like this
    i have a query which lists customer_id, invoice number, amount due
    so what i want is to count the distinct customer_id and display the number of distinct customers. one customer_id can be repeated any number of times but i should count it only once.

  • Sum rows of Column A based on distinct values of Column B

    Hello everyone,
    below is my xml
    <ROWSET>
    <ROW>
    <ORDER_NO>103-4385509</ORDER_NO>
    <SITE_NO>103</SITE_NO>
    <ORDER_ID>4385509</ORDER_ID>
    <CUSTOMER_ID>2676832</CUSTOMER_ID>
    <TAX_AMOUNT>.33</TAX_AMOUNT>
    <CREATED_DATE>08/20/2010</CREATED_DATE>
    <USER_CREATED>TSDAL671</USER_CREATED>
    <Delivery_Method>CARRY OUT STORE</Delivery_Method>
    <Entered_By>TSDAL671</Entered_By>
    <SKU_NO>321182</SKU_NO>
    <NAME_TEXT>MGR_OVERRIDE</NAME_TEXT>
    <ATTRIBUTE_ID>319</ATTRIBUTE_ID>
    <ATTRIBUTE_VALUE>Override Done</ATTRIBUTE_VALUE>
    <DETAIL_SEQ_NO>1</DETAIL_SEQ_NO>
    </ROW>
    <ROW>
    <ORDER_NO>103-4385509</ORDER_NO>
    <SITE_NO>103</SITE_NO>
    <ORDER_ID>4385509</ORDER_ID>
    <CUSTOMER_ID>2676832</CUSTOMER_ID>
    <TAX_AMOUNT>.33</TAX_AMOUNT>
    <CREATED_DATE>08/20/2010</CREATED_DATE>
    <USER_CREATED>TSDAL671</USER_CREATED>
    <Delivery_Method>CARRY OUT STORE</Delivery_Method>
    <Entered_By>TSDAL671</Entered_By>
    <SKU_NO>321182</SKU_NO>
    <NAME_TEXT>OEDTL_TAX_INFO</NAME_TEXT>
    <ATTRIBUTE_ID>314</ATTRIBUTE_ID>
    <ATTRIBUTE_VALUE>441130760|441130760|441130760|1|1|1|20100820|2676832|2|SPARTS|</ATTRIBUTE_VALUE>
    <DETAIL_SEQ_NO>1</DETAIL_SEQ_NO>
    </ROW>
    <ROW>
    <ORDER_NO>103-4385509</ORDER_NO>
    <SITE_NO>103</SITE_NO>
    <ORDER_ID>4385509</ORDER_ID>
    <CUSTOMER_ID>2676832</CUSTOMER_ID>
    <TAX_AMOUNT>.18</TAX_AMOUNT>
    <CREATED_DATE>08/20/2010</CREATED_DATE>
    <USER_CREATED>TSDAL671</USER_CREATED>
    <Delivery_Method>CARRY OUT STORE</Delivery_Method>
    <Entered_By>TSDAL671</Entered_By>
    <SKU_NO>412679</SKU_NO>
    <NAME_TEXT>OEDTL_TAX_INFO</NAME_TEXT>
    <ATTRIBUTE_ID>314</ATTRIBUTE_ID>
    <ATTRIBUTE_VALUE>441130760|441130760|441130760|1|1|1|20100820|2676832|2|0035|</ATTRIBUTE_VALUE>
    <DETAIL_SEQ_NO>2</DETAIL_SEQ_NO>
    </ROW>
    i have to display 3 rows but while doing sum of TAX_AMOUNT grouped by ORDER_ID, i need to sum only for 2 records based on the distinct value of DETAIL_SEQ
    so my output should be some thing like below
    ORDER_ID|TAX_AMOUNT|DETAIL_SEQ|ATTRIBUTE_ID
    4385509|0.33|1|319
    4385509|0.33|1|314
    4385509|0.18|2|314
    SUM = 0.51
    Note : i cannot do distinct in the sql becuase attribute_id is different for same DETAIL_SEQ_NO.
    I tired doing <?sum([xdoxslt:distinct_values(current-group()/DETAIL_SEQ_NO)]/TAX_AMOUNT)?>
    it didn't work.
    Can anyone please help me!!
    Thanks in Advance!!

    That syntax wont work.
    One method of doing.
    <?for-each-group:/ROWSET/ROW;ORDER_NO?>
    <?for-each:current-group()?>
    <?ORDER_NO?>  <?TAX_AMOUNT?>  <?DETAIL_SEQ?>  <?ATTRIBUTE_ID?>
    <?end for-each?> <?xdoxslt:set_variable($_XDOCTX,'sum_attr',0)?>
    <?for-each-group:current-group();DETAIL_SEQ_NO?>
    <?xdoxslt:set_variable($_XDOCTX,'sum_attr', xdoxslt:get_variable($_XDOCTX,'sum_attr')+ TAX_AMOUNT)?>
    <?end for-each?><?xdoxslt:get_variable($_XDOCTX,'sum_attr')?>
    <?end for-each?>

  • OBI columns not showing distinct values.

    Hi,
    Please help me out with the below issue.
    I have a colulmn called Product Type. Same column is been pulled into many subject areas. In one of the subject area the column when checked for all product types, it is not showing distinct values, instead it displays multiple rows of sinlge value. Whereas in other subject areas it dsiplays distinct values.
    So please help me out on this issue.
    Thanks,
    Rajesh S

    Hi,
    I don't think it's not an issue with not selecting "Select Distinct Value" checkbox .. because same column pulled into to other subject areas working fine. But here also sometimes it shows correct distinct value and sometimes all values(Duplicate values).
    Thanks,
    Rajesh.

  • Count distinct values current group

    Hi--
    Is there a way to count the distinct values within the current group? ie--i've got a PO and want to display all the addresses at the shipment level if there is more than one distinct one, but if they are all the same as the header-level address, then I don't want any of them to show up.
    I'm using the following at the header level to tell the header not to show up if there are multiple shipment level addresses, but can't seem to get a similar statement to work when it's sitting at the same level as the group that I want to count.
    This is what I use at the header--it seems to work:
    <?if:count(xdoxslt:distinct_values(PLL_SHIP_ADDRESS_LINE1))>1?>See Details Below<?end if?><?if:count(xdoxslt:distinct_values(PLL_SHIP_ADDRESS_LINE1))=1?>
    POH_SHIP_ADDRESS_LINE1POH_SHIP_ADDRESS_LINE1
    POH_SHIP_ADDRESS_LINE2
    POH_SHIP_ADDRESS_LINE3
    POH_SHIP_ADR_INFO POH_SHIP_COUNTRY<?end if?>
    A really simplified version of the structure of the report is below:
    <?xml version="1.0" ?>
    - <!-- Generated by Oracle Reports version 10.1.2.0.2
    -->
    - <SMTPOXPRPOP2>
    - <LIST_G_INIT_INFO>
    - <G_INIT_INFO>
    <MANUAL_PO_NUM_TYPE>NUMERIC</MANUAL_PO_NUM_TYPE>
    <C_COMPANY>CompanyName</C_COMPANY>
    - <LIST_G_HEADERS>
    - <G_HEADERS>
    <POH_PO_NUM>310001100</POH_PO_NUM>
    - <LIST_G_LINES>
    - <G_LINES>
    <POL_VENDOR_PROD_NUM>12q</POL_VENDOR_PROD_NUM>
    <POL_ITEM_DESCRIPTION>sample</POL_ITEM_DESCRIPTION>
    <POL_QUANTITY_TO_PRINT>10</POL_QUANTITY_TO_PRINT>
    - <LIST_G_SHIPMENTS>
    - <G_SHIPMENTS>
    <PLL_SHIP_COUNTRY>Canada</PLL_SHIP_COUNTRY>
    <PLL_SHIP_ADR_INFO>Calg,AB Zip</PLL_SHIP_ADR_INFO>
    <PLL_SHIP_ADDRESS_LINE3 />
    <PLL_SHIP_ADDRESS_LINE2 />
    <PLL_SHIP_ADDRESS_LINE1>Ad1</PLL_SHIP_ADDRESS_LINE1>
    </G_SHIPMENTS>
    </G_SHIPMENTS> <PLL_SHIP_COUNTRY>Canada</PLL_SHIP_COUNTRY>
    <PLL_SHIP_ADR_INFO>Calg,AB Zip</PLL_SHIP_ADR_INFO>
    <PLL_SHIP_ADDRESS_LINE3 />
    <PLL_SHIP_ADDRESS_LINE2 />
    <PLL_SHIP_ADDRESS_LINE1>Ad1</PLL_SHIP_ADDRESS_LINE1>
    </G_SHIPMENTS>
    </G_LINES>
    <POH_SHIP_ADDRESS_LINE2 />
    <POH_SHIP_COUNTRY>Canada</POH_SHIP_COUNTRY>
    <POH_SHIP_ADR_INFO>Kanata,ON K2V 0A2</POH_SHIP_ADR_INFO>
    <POH_SHIP_ADDRESS_LINE3 />
    <POH_SHIP_ADDRESS_LINE1>XXX Palladium Drive</POH_SHIP_ADDRESS_LINE1>
    </G_HEADERS>
    </LIST_G_HEADERS>
    </SMTPOXPRPOP2>
    Could anyone help out with this?
    Thanks--I'd really appreciate it!
    Kate

    Hi Vetsrini--
    Thanks for getting back to me so quickly! I'd love to email you a copy and the XML if you wouldn't mind taking a look. it'll probably be more clear than me trying to explain.
    I can't quite figure out how to do that, though---your profile doesn't list an email. Do I need to click elsewhere?
    Thanks!
    Kate

  • Displaying the value of an variable on the stage

    I have managed to display the values contained in string variables on stage, and I am happy with that, however when I wish to display the value of an int and convert it to a string as one is supposed to do the output to the stage just calls it [class int] and does not give its value. any suggestions?
    My rogram contains a stage at frame 1 which displays a word. The user must input a word. Frame 30 then displays the word which was displayed and the word input by the user. That all works fine. But the value of the variable NumberRight, which has been assigned to that variable will only display as [class int] without showing its value. (even though I have converet it to a string using the .to string function you see below).
    My code is as follows;
    trace( "The number correct was" + NumberRight); //This works fine in the output window and shows the value of the variable as NumberRight [class int]1 (showing the value to be 1)
    outputText.appendText("in/"+textAtIN); //this works fine displaying the word presented and word input by user as in/in
    outputText.appendText( NumberRight.toString(     )); //here lies the problem as it just displays [class int] and nothing else.
    Yes I have managed to overcome that problem it was some code on the first frame, please excuse, however, now, is there any way to remove the [class int] bit from the displays, I wish to have the results as a clear copy of the results so that they can be printed out, without [class int] all over the place?

    Hi Ned thanks for that. Yes I had accidently created blank spaces in the String() argument. (wanted to check if there was a subsequent difference in display and forgot to return them to normal ...Sorted )
    Your next suggestion has eliminated the [class int] but I get a value now of 0.
    My code on the first frame for a correct response for example is;
    function keyPressedIN(event:KeyboardEvent):void
              if (event.keyCode == 13)/*Normally,this will move straight on to the next frame-
              recording a correct response and all that that implies in terms of scores etc. But now I have re directed it to Frame 30 to check are the variables working properly*/
                        //insert code for correct responses vowels etc.
                        VowelI = VowelI+1;
                        NumberRight = NumberRight +1;
                        stage.focus = stage;
                        //There is no need to display the text box as this is a correct response.
                        pupilsResponseIN.visible = false;
                        mainText.visible = false;
                        gotoAndPlay(30);//at the moment this takes me to the display frame to check if all is ok
    On the first frame when the user say hits the Return key my code assigns the value of +1 to the variable; eg
    NumberRight=NumberRight+1;
    and the value of +1 to the value of VowelI
    VowelI=VowelI+1
    At Frame 30 the code is as follows;
    stop();
    trace( "The number correct was"+ NumberRight);
    outputText.appendText("in/"+textAtIN);
    outputText.appendText( "\n");
    outputText.appendText("Vowels Correct ="+(int(VowelI).toString()));
    outputText.appendText( "\n");
    outputText.appendText("TotalCorrect="+(int(NumberRight).toString()));
    //outputText.appendText( VowelI.toString());
    Now what I am getting  is
    in/in
    Vowels Correct = O
    Total Correct = O
    Yet the trace (output box) records the Number correct as [class int]1 
    many years ago I wrote this same program in Authorware using similar code. I am trying to re write it in FlashCS5 using ActionScript 3 and It take days to solve small problems. I notice also that If for example the user of the program makes an error and I record the error as NumberRight =NumberRight -1 the program records it as Total Correct = NaN .
    I gave up on this a few months back but I am trying again. I think there must be a better way to do this. Variables do not seem to add up or subtract for me at present. no doubt its me thats got it wrong.

Maybe you are looking for

  • I am getting a continued BLUE screen on my Iphone 5s

    I am getting a continued BLUE screen on my iPhone 5s, and it restarting a lot, I don´t understand what is wrong with it. Has this happened to anybody here?

  • How to use bind variables in JSP applications ?

    Hi, How will i use bind variables in jsp applicaions ? Any links that give a clear understanding ? TIA, jj

  • FIN_PCA is activated at Client level or at Company Code level?

    I have two companies already set without FIN_PCA activated. I need to configure a new one and I want FIN_PCA to be active, Could I do this without impacting the other companies?

  • Mapping: Unknown parent node

    I have the following message type to map: <node_1> </node_1> <node_2 </node_2> <node_x> </node_x> In one of these nodes is the message that I actually want. For example: <node_7>   <a>     <a1>bla bla</a1>     <a2>blab la bla</a2>   </a> </node_7> Th

  • Problem displaying table generated by jsp

    Hi! I�m trying to build a dynamic form by calling different servlets from my jsp-page. Somthing goes wrong however, the first <select> generates another <select>, but when the second generates the third, the second <select>-table is overwritten. Why?