How to get a count of unique records

How do you get a count of unique records? Looking only for one number, not a list..so if the data is:
ID
===
1234
1234
1234
1236
1236
1237
Then, the count total will be one field called 'ID' with the value '3' in it..
All I know how to do is get a count that will count all records, or do it in two queries. Looking to do this in one query statment..
Thanks..

Just a small clarification...
Concatenation could potentially give wrong result, depending on the data.
For example...
sudhakar@ORCL>ed
Wrote file afiedt.buf
  1  with t1 as
  2  (select 'AA' c1, '101' c2 from dual union
  3  select 'AA1' c1, '01' c2 from dual union
  4  select 'AA101' c1, null c2 from dual union
  5  select 'BB2' c1, '345' c2 from dual union
  6  select 'AA101' c1, null c2 from dual union
  7  select 'BB2' c1, '345' c2 from dual union
  8  select 'BB234' c1, '5' c2 from dual
  9  )
10* select count(distinct c1 || c2) from t1
sudhakar@ORCL>/
                    2IMHO, the required answer will be...
sudhakar@ORCL>ed
Wrote file afiedt.buf
  1  with t1 as
  2  (select 'AA' c1, '101' c2 from dual union
  3  select 'AA1' c1, '01' c2 from dual union
  4  select 'AA101' c1, null c2 from dual union
  5  select 'BB2' c1, '345' c2 from dual union
  6  select 'AA101' c1, null c2 from dual union
  7  select 'BB2' c1, '345' c2 from dual union
  8  select 'BB234' c1, '5' c2 from dual
  9  )
10* select count(distinct c1 ||'.'|| c2) from t1
sudhakar@ORCL>/
                         5
sudhakar@ORCL>vr,
Sudhakar B.

Similar Messages

  • How to get the count of the records

    Hi all,
    how can we get the record count after the read statement.Means if we write a read statement based on a condition,then how can we know that how many records get effected for this read statement

    You can use loop statement to read the records and write in some internal table and after the end of the loop, you can use describe command to find the number of records.
    For eg. DESCRIBE TABLE tablename LINES lines.
    Here the "Lines" field will give the total number of records present in the table "tablename"

  • How to get attendies count for a calendar list in sharepoint 2013?

    Hi everybody,
    I am using calendar list in SharePoint 2013 for my project.
    Could please tell me how to get the count of attendees using SP Designer or OOTB calculated field.
    Because I want to display the fields like
    TOTAL SEATS =20
    Attendees= Need count
    Avail seats= total - Attendees count.
    In that way I want to show information about availability seats for training session.
    Regards,
    Dhayanand

    Hi Dhaya
    Please refer the links.Hope it helps :-)
    http://social.msdn.microsoft.com/Forums/en-US/b8677dc5-3eb1-4bdc-92f2-f57201bfabb1/field-that-counts-attendees?forum=sharepointcustomizationprevious
    http://sharepoint.stackexchange.com/questions/54253/use-count-related-column-value-as-int-in-a-sp-designer-workflow

  • Multi Mapping : How to get Message count after splitting

    Hi all,
    I am following below blog.
    /people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
    Can any body please tell me how to get the count of messages generated after splitting in the message mapping.. I have created the message data type but not aware what is needed to be done.
    Thanks and best regards,
    Kulwant Singh

    Multi mappings r done in order to split the messages to the number of messages required by the user. So for 1:N mapping, the details about "N" is based on ur requirement. So its not like - when u split, any number of message could get created. The count would be dependent on u.
    Regards,
    Prateek

  • How to get file count in variable?

    dear all,
    how to get file count in variable?
    regards
    Naseer

    Hi Nazeer ,
    It wont take much time .. so simple :- )
    Create one os comand step
    ( for unix) Use
    wc -l filename.txt > someoutputfile.txt
    Now the number of lines in your file will be there in the output file ( someoutputfile.txt )
    Step2 :-
    Now use Cezar's logic to fetch the variable value ( file count ) from the output file .. ( select value for a variable from a file )
    This will not take eeven a second to finish the job.
    Regards,
    Rathish A M

  • How to get Page Count of pdf in Document library in EventHandler

    Hi,
    How to get Page Count of pdf in Document library once uploaded has been done and i would like to update the page count value in document library column of the corresponding file.
    I should achieve it in Event handler.
    Which even should i use, either ItemAdded or "ItemUpdated "?
    Thanks & Regards
    Poomani Sankaran.

    Hello,
    If you are looking for file download or view count then event handler will not work. You need to enable the analytic report to your site. Once you enable it then you can see the report within a browser or you can also create custom webpart to show count
    of specific file.
    http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx
    http://sharepoint.stackexchange.com/questions/34611/count-of-files-under-a-folder-in-a-document-library
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How about get item count of table in formGroup.vm

    JHeadstart Team:
    I want change maxColumns=" 1" or" 2" by item count of table .but I do not know how about get item count of table .
    #if (${JHS.current.group.columns} > 10)
    #set ($majin = 2)
    #else
    #set ($majin = 1)
    #end
    <af:panelForm rows="1" maxColumns="$majin" width="${JHS.current.group.formWidth}" id="${JHS.current.group.shortName}FormItems">
    majin
    #FORM_ITEMS()
    </af:panelForm>

    You can do this using the following syntax:
    #if (${JHS.current.itemContainer.items.size()}>10)
    maxColumns="2"
    #else
    maxColumns="1"
    #end
    Steven Davelaar,
    Jheadstart Team

  • Getting a COUNT of unique document numbers loaded

    What do i need to use in the Mapping in order to get the following results :-
    I am loading from a Purchase Order Item table (with Purch.Ord. number as the key). As this is an item detail table, there will be multiple records for 1 purchase order no. the result i need is a COUNT of the unique list of PO numbers loaded from this table. how can i achieve this ?
    even if i load from the PO header table (which will give me unique PO numbers for each record), how do i get the COUNT of records loaded from the table and use that result to put into my data warehouse target ?
    thanks for any replies in advance !

    thanks for the answer Igor. you have partially answered my question (as i am a newbie to OWB, i have to test out your suggestion to see if i can achieve the results you mentioned).
    maybe an example will make my question clearer.
    Assume 1 have records for 2 POs in table PURCHORD:-
    PONUM POITEMNO PRDCODE QTY
    10000 001 PRD_A 10
    10000 002 PRD_B 2
    10001 001 PRD_A 5
    10001 002 PRD_B 1
    10001 003 PRD_C 10
    the result i expect if i extract records from this table i => 2 unique Purchase Orders (my measure in the Cube is count of POs)! it is basically a COUNT on the "DISTINCT (GROUP by PONUM)". i just can't figure out how to implement this in OWB.
    thanks again

  • Select Count(*) from Sample_table - how to get the count using JDBC?

    Hi All,
    It would be glad if anyone could help me with this. The problem is that I have to get the 'count' of records selected from a arbitrary table say, 'sample_table'. Is that possible to form the SQL in JDBC as
    Select Count(*) from Sample_table
    and get the value of the count? If yes, how?
    Thanks in advance
    Prabz

    stmt = con.createStatement();
    ResultSet recordcnt_rs = stmt.executeQuery("Select Count (*) as record_ctr From Sample_table");
    recordcnt_rs.next();     
    record_ctr = recordcnt_rs.getInt("record_ctr");
    hope this helps.

  • How to get the count of each minutes

    Oracle 10 DB
    Hi All
    I using this query to get the count of records fetched by the concurrent program per min,
    select count (distinct b.attribute2)
    from oe_order_headers_all a,oe_order_lines_all b
    where a.header_id=b.header_id
    and b.flow_status_code ='AWAIT_QUINTIQ_BOOK'
    and to_Char(b.last_update_date,'DD-MON-YYYY HH24:MI:SS') between '19-JAN-2011 02:00:01' AND
    '19-JAN-2011 02:00:02'
    This is used to get the count of records fetched at one mins
    How to find the count of last 10 mins ie 1 mins count 2.00 to 2.10
    Thanks & Regards
    Srikkanth.M

    Try this:
    SELECT TRUNC(b.last_update_date, 'mi') time_mins, COUNT(DISTINCT b.attribute2)
    FROM   oe_order_headers_all a,
           oe_order_lines_all b
    WHERE  a.header_id = b.header_id
    AND    b.flow_status_code = 'AWAIT_QUINTIQ_BOOK'
    AND    b.last_update_date >= to_date('19/01/2011 02:00:00', 'dd/mm/yyyy hh24:mi:ss')
    AND    b.last_update_date < to_date('19/01/2011 02:10:00', 'dd/mm/yyyy hh24:mi:ss')
    GROUP BY TRUNC(b.last_update_date, 'mi');I'm not sure why you're bothering with the join to the oe_order_headers_all table, since you're not referencing that in the where clause or the selected columns list. I think you could probably do away with it.
    I've changed your code to take the last_update_date and truncate it to the minute level, and added that as a column, so you can see which count goes with which minute. Obviously, this has to be in the group by.
    I've also changed your date comparisons so that you're actually comparing dates to dates, rather than strings to strings - why would you deliberately take information away from the optimizer? Oracle does not treat strings the same as dates, and forcing it to use strings rather than dates could lead you to have a vastly differing execution path, which will most likely be less performant.
    Not to mention, coding like that leads you to assume that you can compare dates in strings without any problems, and that is just not the case. '19-FEB-2011' is counted as being earlier than '19-JAN-2008', as strings sort alphabetically.

  • How to get the last time a record was modified or created ?

    Is there a way (hidden system fields for example, system view, other ?) to get the last time a record of a table was modified or the date it was created.
    Thanks for any help.
    Stiphane CAMPION

    blarman74 wrote:
    I know I could do this with a trigger, but I was wondering if there is a data dictionary view I can query to find the date/time a table was last updated. What I have is a table that is constantly getting hammered with new data being uploaded from a third party. We need to keep close tabs to verify that this datafeed is constantly running and bringing in new data. Because the data that comes in comes from multiple timezones and there are hundreds of lines, our attempts at monitoring by just looking at the data leave something to be desired.
    Any ideas?refer this links
    How to find Last modified/updated time of a particular table
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1590655700346557237
    Thanks

  • How to get the count of repeating elements in a xml doc.

    In many xml documents, in is common to have repeating child elements and what I would like to know is how do I determine exactly how many of these child elements exist in a particular document. There is probably a correct XPath string to determine this, but I cannot figure out what it is. Here is an example
    <a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>
    The above 'c' element is what varies in number from document to document and I need to know how to get the number of 'c' elements for the document, which would be 3 in the above case.

    create table test_xml(data xmltype)
    insert into test_xml values(
    xmltype('<a>
    <b>
    <c>1</c>
    <c>5</c>
    <c>22</c>
    </b>
    </a>')
    select extract(data, '/a/b/c').getclobval() from test_xml
    select count(*) from test_xml
    where existsnode(data, '/a/b/c')=1
    good luck.

  • How to get the count of PO'S raised by a user

    Hi,
    I have a new requirement whr i am asked to get the count of number of PO'S raised by a particular user in report. Suppose the user raised 10 purchase orders .
    The requirement is when a user name is given it has to give count of 10.
    Where shud i include this,in rows or columns. Please suggest.
    Thanks&Regards,
    Praveen

    Hi Praveen,
    take a look in www.service.sap.com/bi, under old release, for release 2.x you will find an How to that detail how to count occurencies of a Char. Maybe you will find here the solution.
    Ciao.
    Riccardo.

  • How to get the count of all the entries in the DB?

    I want to know the way getting the count of the entries in a DB. Not using cursor to visit all entries and record the count.
    Message was edited by:
    user633842

    Hello,
    Yes, depending on the type of database you are using, the
    following statistics from DB->stat, look like what you want.
    For Hash databases:
    hash_ndata;
    The number of key/data pairs in the database. I
    For Btree databases:
    bt_ndata;
    For the Btree Access Method, the number of key/data pairs
    in the database.
    For the Recno Access Method, the number of records in
    the database.
    For Queue databases:
    qs_ndata;
    The number of records in the database.
    Additional details are at:
    http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/db_stat.html
    Thanks,
    Sandra

  • How to get the Count of a logic?

    Hi,
    Very new to CRM. I am trying to get the count of "activity start time" that are greater than current time stamp. Count(activity start time) work. I don't know how to add the time stamp condition to this. I can't add this condition as filter.
    Appreciate any responses.
    Thanks

    Raghu,
    Thanks for the help. It works to get the count.
    The problem is, i have some other filters set and can't combine this filter. Here is my scenario:
    get all activities on a contact that have greater than x $ amount as assets. I need to find the number of future appointments for that contact and start time of first pending future appointment. All has to be in one report.
    My columns are for example : contact name, activity start time, end time, subject, next pending appointment start time, total future appointments, some other related fields from contact
    So when I add the filter that you had given, it will not give me all activities. I am able to achieve all this in seperate reports and unnable to get it in single one.
    Thanks,
    GiGi

Maybe you are looking for

  • Attachments

    Attachments does not work properly: when I try to upload a file, the system returns an error message because it cannot open the file fndufile.exe.. is it a problem of my system configuration or a bug? Does anybody have setup attachments features? Tha

  • How do i reset password for icloud email account which is not the same as my apple id password? I cannot see this anywhere in the online support pages.

    How do I reset an icloud email password on my iphone? It is not my apple id password. I cannot see anything in the online support at Apple.

  • Using Acrobat with websites

    Hey Everyone, I can't live without Acrobat at work because of all the features.  I love the way it looks but was wondering if I loaded it to web page would Google recognize it the words on it or am I handcuffed in doing this?  It would allow me to se

  • What Mini to buy when considering viewing 720p QT trailers?

    I have used the G4 mini in my theater room several weeks now and am very pleased. So now that I know it works, oh so better than the HTPCs that I had built, I want to place a Intel mini into the theater room. My G4 mini is fine with 480p trailers, an

  • App not responding

    i have an app that has stopped responding and i closed it multiple times and deleted and reinstalled a couple too and its still not working. everything else is fine.