Count the rows which differes a column value

msg deleted
Edited by: user11253970 on Jul 14, 2009 11:33 AM

Perhaps this
with a as (
     SELECT cert_no, count(distinct RACE_CODE) RACE_CODES   FROM subscriber
     group by cert_no having count(distinct RACE_CODE) > 0 )
b as (  
     SELECT cert_no, count(distinct RACE_CODE) RACE_CODES FROM med_subscriber
     group by cert_no having count(distinct RACE_CODE) > 0 )
c as (
     select cert_no, count(distinct RACE_CODE) RACE_CODES from den_subscriber
     group by cert_no having count(distinct RACE_CODE) > 0 )
select  cert_no, a.race_codes + b.race_codes||' (in med_subscriber and subscriber tables)'
        ||' , '||  c.race_codes ||' (in den_subscriber table).'  col1
from a , b ,  c
where a.cert_no = b.cert_no
and a.cert_no = c.cert_no
  note: not tested for your data.
SS

Similar Messages

  • Count the rows which are selected ?

    Hi Experts,
    I need help.My requirement is:
    I am having a table which can be multiple selected. But there are two buttons attached to it.Edit and Delete.For Delete I want the Multiple Selection not for EDit.So, If i will click the Edit after multiple selection of the rows.How i can give pop-up that multiple edit is not possible?Means I want to count the rows which are selected how to do that?
    Please guide me.
    Urgent need
    Regards
    Nutan

    Hi Nutan,
    Marcel is right about backend. However I might have an idea once I am developing a quiet similar solution. I would like to ask you to explain with more detail. It seems you have two requirements in one question.
    Regards,
    Gilson

  • Formating the Row Based on one column value

    Hi Friends
    I am trying to format the Entire row based on the value of the first column in my Answers.
    Example if first column value in 'F' now i want the Entire row to be colored
    I can do conditional formating on one column but i want to do it on the entire row
    F     8.1 %     12.0 %
    E     5.2 %     3.5 %
    M     2.3 %     3.3 %
    If any one has done this or any suggestions please respond
    Thanks
    Sang

    Its a Pivot View
    F 8.1 % 12.0 %
    E 5.2 % 3.5 %
    M 2.3 % 3.3 %
    the column 1 --> F,E,M are the Product
    the column 2 --> 8.1% , 5.2% , 2.3% are the sales in year 2008
    the column 3 --> 12.0 % , 3.5 %, 3.3 % are the sales in year 2009
    So will i be able to apply the formating in pivot view based on one column to other column If yes please let me know how or
    suggest if this can be done using the BI Office , or BI publisher
    sing the BI Office i can do the formating in Excel but once i refresh the data all the formating is gone ... :(
    I am donno BI Publisher if we have to use BIP please suggest any solution its very very very urgent and important report formating they need here ....
    Thanks in advance David
    sango

  • Change the row colors based on column values in MOSS 2007.

    Hi Team,
    I am using MOSS 2007 environment. In that I am having one SharePoint list. In that list based on column values rows colors need to change.
    Kindly help me anyone on this.
    Thanks,
    Ashok

    Hi Ashok,
    Please follow the below link:
    http://www.contentmaster.com/sharepoint-2010/conditional-formatting-of-list-views-for-sharepoint-2010-changing-the-font-colour/
    http://sharepoint.stackexchange.com/questions/7478/highlight-row-color-based-on-field-values-in-sharepoint-2010-list-view
    Best Regards,
    Brij K

  • Csv input adapter - read rows with different # of columns

    I have a csv file which includes rows with different number of columns. I want to read all the rows( of different # of cols)  into ONE stream only and then split into separate streams afterwards.
    I saw that CSV File Input Adapter does not add missing columns with nulls by default. Is it possible somehow? How can I generate a workaround?
    Thanks.

    Hello,
    The CSV Input Adapter expects to find a fixed number of fields.  If you attach the input adapter to a stream/window with 3 fields, it will always try to read three fields.  You can have missing data and this will be read into a column as a NULL value but the delimiters must still be there.  For example:
    1,1,1
    2,2,2
    3,3,3
    4,,4
    5,5,5
    CREATE INPUT WINDOW inWindow SCHEMA (c1 integer, c2 integer, c3 integer) PRIMARY KEY (c1);
    ATTACH INPUT ADAPTER File_Hadoop_CSV_Input2 TYPE toolkit_file_csv_input TO inWindow PROPERTIES csvExpectStreamNameOpcode = FALSE ,
      dir = 'c:/temp' ,
      file = 'test.csv' ,
      csvDelimiter = ',' ;
    A workaround you might consider is reading an entire line from your file into a stream with a single string column.  The trick is that you have to choose a character for the column delimiter that you are certain will never show up in your data.  Than once you have read that line into a stream, you can use the string functions to parse out the columns as needed:
    CREATE INPUT STREAM csv_instream SCHEMA (
      log_line_message string
    // Choose a character that is certain to never show up in the data in order to read the entire line
    // from the CSV file into a single column
    ATTACH INPUT ADAPTER File_Hadoop_CSV_Input1 TYPE toolkit_file_csv_input TO csv_instream PROPERTIES
      csvExpectStreamNameOpcode = FALSE ,
      dir = 'C:/temp' ,
      file = 'error_log' ,
      csvDelimiter = '@' ;
    // Parse out the individual columns
    CREATE OUTPUT STREAM csv_outstream SCHEMA (
      log_datetime timestamp ,
      debug_level string ,
      host string ,
      message string ) AS SELECT
      to_timestamp(substr(CI.log_line_message, 1, 24), 'DY MON DD HH24:MI:SS YYYY') as log_datetime,
      substr(CI.log_line_message, patindex(CI.log_line_message, '[', 2)+1, (patindex(CI.log_line_message, ']', 2) - patindex(CI.log_line_message, '[', 2))-1) AS debug_level,
      replace(substr(CI.log_line_message, patindex(CI.log_line_message, '[', 3)+1, (patindex(CI.log_line_message, ']', 3) - patindex(CI.log_line_message, '[', 3))-1), 'client ', '') AS host,
      substr(CI.log_line_message, patindex(CI.log_line_message, ']', 3)+1, 500) AS message
      FROM csv_instream CI
      WHERE CI.log_line_message IS NOT NULL;
    Thanks,
    Neal

  • Count the rows in a list-component

    Hi,
    How can I count the rows with a value in a list component?
    I thought it would be RowCount but as I figured out that shows the number of shown rows, not the number of rows with a value.

    Hi,
    Try list.dataProvider.length

  • Join all rows bases on one column value

    Hi All,
    I have requrement like Join all rows bases on one column value, i am not getting how to accomplish that. Here is my requrement. i have table test(id,id_desc) with no key
    table:Test
    id id_desc
    1 desc_a
    1 desc_b
    1 desc_c
    Now the requremnet i have one more table as test1(id,id_desc) here id is primary key. where record i need to insert as
    id id_desc
    1 desc_a
    desc_b
    desc_c

    orza wrote:
    Hi All,
    I have requrement like Join all rows bases on one column value, i am not getting how to accomplish that. Here is my requrement. i have table test(id,id_desc) with no key
    table:Test
    id id_desc
    1 desc_a
    1 desc_b
    1 desc_c
    Now the requremnet i have one more table as test1(id,id_desc) here id is primary key. where record i need to insert as
    id id_desc
    1 desc_a
    desc_b
    desc_cI'm guessing you want to pivot the results in TEST and use that to insert into TEST1?
    If so this may be useful
    http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php

  • Help Needed: Facing the error ORA-01406: fetched column value was truncated

    Hi Everyone,
    When I run a particular PL/SQL query using Oracle 9i ODBC driver, it is working fine and fetching me the desired results.
    However, when I run the same query using the Oracle 10g ODBC driver, I am getting the error: ORA-01406: fetched column value was truncated.
    I have checked all the fields of the table and they are well within the allowable limit.
    Can you please let us know what needs to be done to resolve this issue?
    Thanks and Regards,
    Sudhindra

    Well it's obviously a problem with the client software. Doesn't Datastage have some way of configuring these things?
    rgds, APC

  • Counting the rows

    Hi,
    I've a datamodel with BI Query. I want count the rows like a rownum function. How can I do this?
    Thanks R.
    Edited by: user12003776 on Jan 26, 2012 5:02 PM

    Do you want to get a count of rows in the query or do you want to find the count in the template? Rownum function returns the rows' position.
    If you want to find the count of rows within the template for some conditionally formatting, then you could use something similar to this:
    <?count(/XXTA_SHIP_LABEL/LIST_G_CUSTOMER/G_CUSTOMER)?> -- change the path to the field in your dataset
    Can you explain a bit more as to what you are trying to do?
    Thanks,
    Bipuser

  • Optimise query on the table which contain 1000 column

    Hi ,
    I have query on the table which contain 1000 columns
    when i am executing query on same table .It is taking time .
    Select * from abc
    where col1 between start_date and end_date ;
    abc table contain 1000 columns.
    please tell me how to optimise query

    Yeah, that was my thought as well ... 1000 columns? wtf?
    I can't think of many reasons for why you'd need to do a select * on it, and the scenarios that would require that are better addressed at the DBA level, perhaps using db replication and the data pump, etc. So to start with try selecting just the data you would need.
    One thing you can do right off the bat is to partition that table by date, and also to analyze and run statistics on it (this was a nightly operation at my last job).
    You can also create a materialzed view that refreshes overnight, just on the slice of the data you need. Use a forced fast refresh to make it current before you use it.

  • Counting rows based on a column value

    Tricky Query.No offence if this is a repeat please.
    This is a PROD issue in SYBASE.
    TableA has id_flag_listing column
    TableA
    id_flag_listing
    N
    N
    N
    N
    N
    1) If all rows are set to 'N',then my count should be 0.
       PrimaryListing
       0
    2) If there is one row which is 'Y' then this shoud be:
       id_flag_listing
       N
       N
       Y
       N
       N
       PrimaryListing
       1
    How can I count in this manner?
    Do i use decode? I am using
    Select sum(decode(flg_active),'Y',1,0))
    from TABLEA
    Will the above work.??
    I am using SQL for Sybase.
    Please guide?

    Did you even tried the SQL query I've given?
    Your table A
    SQL> SELECT flg_listing
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'N' FROM DUAL
      9     UNION ALL
    10     SELECT 'N' FROM DUAL
    11     UNION ALL
    12     SELECT 'N' FROM DUAL
    13  ) TABLEA;
    FLG_LISTING
    N
    N
    N
    N
    N
    Your table A, from which I count where are of 'Y' value. In these queries, I change TableA contents.
    SQL> SELECT count(*)
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'N' FROM DUAL
      9     UNION ALL
    10     SELECT 'N' FROM DUAL
    11     UNION ALL
    12     SELECT 'N' FROM DUAL
    13  ) TABLEA
    14  WHERE flg_listing = 'Y';
      COUNT(*)
             0
    SQL> SELECT count(*)
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'Y' FROM DUAL
      9     UNION ALL
    10     SELECT 'N' FROM DUAL
    11     UNION ALL
    12     SELECT 'N' FROM DUAL
    13  ) TABLEA
    14  WHERE flg_listing = 'Y';
      COUNT(*)
             1
    SQL> SELECT count(*)
      2  FROM
      3  (
      4     SELECT 'N' flg_listing FROM DUAL
      5     UNION ALL
      6     SELECT 'N' FROM DUAL
      7     UNION ALL
      8     SELECT 'Y' FROM DUAL
      9     UNION ALL
    10     SELECT 'Y' FROM DUAL
    11     UNION ALL
    12     SELECT 'Y' FROM DUAL
    13  ) TABLEA
    14  WHERE flg_listing = 'Y';
      COUNT(*)
             3Yoann.

  • How to retrieving latest row based on a column value

    Hi,
    Lets consider a scenario. I have a table which has a order number, count column which is our fact, a type column which contains types e.g. (A,B) with A has more priority then B. Now in our graph we are getting all rows i.e. if we have two rows in db for order #1 one for type A and one for type B, then it shows us data from both rows in graph.
    But I need only to show one row of type A in this case as A has higher priority than B. The row with type B should not contribute in construction of my graph if type A for same row also exists.
    I tried a solution, for which i created a new column at logical level which contain 1 for A and 0 for B. Now i put Max aggregation rule in it to get maximum value which will be row with Type A in our case. But it did not work.
    How we will can achieve it in OBIEE?
    Thanks.
    Aasim Khan.

    Hi Steve,
    I have a similar requirement... one of the columns in my table is a calculated value based on several xml fields,
    <?xdofx:(MATH01+MATH02+MATH03+MATH04+MATH05+AA+AA1)+((FNDCD01+FNDCD02+FNDCD03+FNDCD04+FNDCD05+MCHCD01+MCHCD02) div '8')?>
    if the resultant value above is less than 62, i do no want to display this entire row in the output. could you help me wout with this?
    thanks
    Domnic

  • Count of rows from different tables.

    Hi Friends,
    I have 4 tables with a common column name "ID". I would like to get the count of rows from all the four tables which has the same ID.
    Ex
    select count(a.id) from table1 a,table2 b,table3 c,table4 d where a.id=b.id=c.id=d.id=5;
    please suggest me some solution

    may be thsi?
    select count(a.id) from table1 a,table2 b,table3 c,table4 d
    where a.id=b.id and a.id=c.id and a.id=d.id and a.id=5;

  • How to know Number of the Row which is selected in Advanced table

    Hi All
    I have a requirement where in an advanced table, when user clicks on copy icon against a row..a new row is created with copied values of the row against which copy action is performed.My issue is: assume in table i have got 5 rows..when user clicks on copy..my copied row gets created in the end..but i want tht row to be created directly under the row against which copy action is performed.I think somehow if i am able to know the position number of the row against which copy action is performed..i should be able to achieve it...can you please help me on this.
    Thanks
    Raj

    hi raj,
    create a fire action to the copy image.
    and then copy this method in to u r AM,
    public void copy action(String s)
    PwrPosViewShipmentsVOImpl sVO = getPwrPosViewShipmentsVO();
    RowSetIterator rowsetiterator;
    OADBTransaction oadbtransaction;
         rowsetiterator = sVO.findRowSetIterator("ships");
    int i;
         int j;
    if(rowsetiterator == null)
    rowsetiterator = sVO.createRowSetIterator("ships");
    oadbtransaction = getOADBTransaction();
    rowsetiterator.reset();
    i = 0;
    if(!sVO.isPreparedForExecution())
    rowsetiterator.setRowValidation(false);
    String s1;
    PwrPosViewShipmentsVORowImpl sVORowImpl1;
    PwrPosViewShipmentsVORowImpl sVORowImpl=null;
    do
    if(!rowsetiterator.hasNext() || i >= sVO.getFetchedRowCount())
    break;
    i++;
    sVORowImpl = (PwrPosViewShipmentsVORowImpl)rowsetiterator.next();
    s1 = copyServerUtil.replaceNull(sVORowImpl.getAttribute("view attribute of the referenced column"));
    } while(!s.equals(s1));
    j = sVO.getRangeIndexOf(sVORowImpl);
    sVORowImpl1 = (PwrPosViewShipmentsVORowImpl)rowsetiterator.createRow();
    sVO.insertRowAtRangeIndex(j + 1, sVORowImpl1);
    rowsetiterator.closeRowSetIterator();
    * create a new class file under the server folder and paste the below into that. and then import that class file into u r AM. and then try to run as a whole. u will get ur required work.
         public static final String replaceNull(Object obj)
    if(obj == null || obj.equals("null"))
    return "";
    } else
    return obj.toString();
    }

  • Retrieving the row number where a certain value exists

    Hi,
    I wanted to find out if there is a way to retrieve the row number of a row where a certain value exists. For example, if I had a query
    Create or replace Procedure p1
    IS
    v_Stmt varchar2(100);
    BEGIN
    v_Stmt := 'Select * from emp where lname = 'Davis'';
    Execute Immediate v_Stmt;
    END;
    SQL> exec p1;
    Then, I would like to find out that this name is on row 3.
    Can anyone tell me how this can be done?
    Thanks in advance.
    Sincerely,
    Nikhil Kulkarni

    theres is no rownum related to a particular row. A rownum is a pseudocolumn which value may be different for the same row depending on the query you do. What you can use is the rowid which is the row's address.
    HTH
    Maurice

Maybe you are looking for

  • Interactive PDF stopped working after upgrade to Safari 7.1 (i.e. all Mavericks users), Suggestions?

    We have a set of interactive PDF forms that our users access via the web.  We have to use the PDF forms online because they are configured to pre-fill basic information that is acquired from our database/information system, which our users can only a

  • Cannot get Time Machine to work

    I just installed Leopard on my Power MacG4. I can't get Time Machine to work. I have gone to Utilities and repaired partitions twice. That doesn't seem to be the problem. I have no idea what to do. Any ideas?

  • Passing an array of objects to a method.

    Hi I'm building a program to act as a CD Collection Database. An array of objects represents the entries: Artist, Album and NUmber of Tracks. What I want to do is in the Menu, user to choose wether he or she wants to Add new CD to collection, print o

  • Has anyone managed to install aperture 2 with a 12" G4 laptop?

    Mine runs Leopard 10.5.2 with a 1.5 Ghz processor and 1.25GB of memory. The system checker says it's fine but it tells me my graphics card will not work it properly. My graphics card is the GeForce FX Go5200. Has anyone managed to get it installed, i

  • Photos blow up when set to wallpaper

    I want to set a photo from my gallery to my wallpaper. When I do this it blows the photo up, how can I get this to stop? does anyone know the proper sizing?