Counting across views & comparing

I have several views all of which have the following structure:
id number
value number
Now in a loop, I have the names of all the views I'm interested in. From the list of those views, I do a count grouping by the id as:
select id,count(id) from myview group by id;
This will give me a list like:
id count
100 3
200 1
Now, I need to do a similar count in the second view and all the other views from my list. Upto this point its ok .But now, I need to sum up the similar values obtained from these views. For example in the second view if I got the following result:
id count
100 1
300 1
Then my final result should look like:
id count
100 4
200 1
300 1
Thats not enough.
After storing these final values somewhere, I need to compare each of these individual counts with the results obtained from a similar query on another table
by each id.
Any help will be greatly appreciated.

Thanks for the first part. But, it doesn't fit my requirement because I am getting the view name one by one in a loop and I can't do the union all at a time. I guess what I need is an array or a PL/SQL table to hold the values in each subsequent count and then keep on adding the values to the array. Then ultimately I need to compare the values in the array with the values I obtain from executing a query against a table. This will be like:
If the values in the array are:
myarray(id,count)
with the values(100,4) (200,1),(300,1)
Then I execute a query against a database table as:
select id, count(id) from mydatabasetable group by id;
Then I should be able to compare the values in the array/PL/SQL table with the results obtained by this query.For example: how many 100s, 200s.. are there in the array against how many 100s, 200s.. are there in the database table. I hope the problem is understandable now.

Similar Messages

  • HT2518 I am trying to move across & view my home movie clips from my PC to Mac, but I can't view them.  What do I need to have installed on the MAC to view such files? (Originally put onto the MAC from a Canon video camera)

    I am trying to move across & view my home movie clips from my old PC to my new Mac but I am unsure what software I need to view them.  They are from a Canon video camera originally.  Please advise how this is done!

    Do they have a file extension?
    How about anything on the camera which might indicate what it is, like AVCHD?

  • List of tables count and Views count in schema wise

    Hi All,
    I want to get all tables count and views count in Schema wise, What is the query for that?
    Thanks in Advance.

    SELECT COUNT(*) FROM sys.tables t join sys.schemas s
    on s.schema_id=t.schema_id
    SELECT COUNT(*) FROM sys.views t join sys.schemas s
    on s.schema_id=t.schema_id
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • View/Compare Documents does not appear

    How can I get View/Compare Documents to appear in Acrobat X?

    Do you have Acrobat X Pro or Standard? Because this feature is only
    available in Pro...

  • How to get count,index and compare to arraylists

    hi
    how to get count,index and comparing of 2 arraylist.... plz suggest me asap...

    How is your question related to JDBC? And what have you done so far with your code?

  • I have Adobe Acrobat XI (ver 11.0.07).  Adobe Help instructs me to find the document comparison command at "View Compare Documents," however, this command does exist on my screen. My View drop-down list does not include a command for Compare Documents.

    I have Adobe Acrobat XI (ver 11.0.07).  Adobe Help instructs me to find the document comparison command at "View > Compare Documents," however, this command does exist on my screen. My View drop-down list does not include a command for Compare Documents.  Where else can I find this command?

    What version of Acrobat do you have? This feature is only available in the Pro version, not in the Standard version.

  • Problem w/: Error while getting estimated row count for view

    JDev 10.1.3 - Steps
    1. created a ADF VO w/ one bind variable vNAME.
    2. Created a basic jspx page, use the data control pal. to drop in VO w/ executeparam option. Use the data control pal to drop in VO w/ ADF Read-Only Table w/ select and sort option. Selected all VO columns in table.
    3. Following Error msg occurs when running jspx page -
    oracle.jbo.DMLException: Error while getting estimated row count for view object CategoryView, statement SELECT count(1) FROM (SELECT
    CATEGORY.CATID CATID,
    CATEGORY.NAME NAME,
    CATEGORY.PICTURE PICTURE,
    CATEGORY.ACTIVE ACTIVE
    FROM
    CATEGORY
    WHERE
    (CATEGORY.NAME LIKE UPPER(:vName)||'%')) .
    Tested SQL Statement in SQL Worksheet works ok (with a Value replacing ':vName').
    Can anyone advise - seems to be a straight forward process that is returning this error msg. I have tried variations of the SQL stmt with no luck. The jspx page errors when the ADF Read-Only Table is added.

    I seem 2 have the same error, in a slightly different situation.
    I have a view which subclasses a Entity with a history column 'CreatedOn'. When performing a quick search/filter on this column I get the same error. The ADF app is build on a DB2 database, so no named parameters here. Instead invalid SQL is created when executing the estimated row count. The WHERE clause contains 'CreatedOn = null', should be 'CreatedOn is null'. Furthermore the input of my quick search is not filled in this clause.
    Any help would be appreciated

  • Why are my iCal events not the same across views?

    Help!  I've been editing my iCal in Month view and everything looks great... but then I look at the day view (or week, whatever) and it's not the same.  For example, in Month view for July 2 - I have one event scheduled from 8:30-noon.  Then I look at the day view... and there are 8 different events!  Most of them duplicates of different things that I had at one time or another deleted or changed.  Why didn't the "clean up" work that I did in the month view carry over to day or week view?  In fact the opposite, there are more things in day or week views than I ever created.
    Recently upgraded to Lion from Snow Leopard.  Recently changed from mobileme to iCloud.  I only have iCal set to my iCloud account (no "on my mac" iCal calendar data). So the problem I see when editing on my MacBookPro is also seen when logged into iCloud directly via Safari and on my iPhone, iPad, etc.  At first I thought this was an iCloud syncing error because I only noticed the difference on my phone (list view)... but when I went back to my MacBookPro I realized the problem exists there too... so doesn't seem to be a syncing error, but rather a "view" error... then the "problem" is mirrored everywhere.
    I've tried "refresh" and "refresh all" from the Calendar drop down menu.  This does nothing to help the problem... not that I really expected it would.
    Thanks for any help you can provide.  I'm going crazy!
    Mac OS X 10.7.4; iCal 5.0.3

    Fixed my own problem.  Ultamately a user error but tied to the many threads about the month view defaulting events to "all day" vs. hourly increment.  I knew that was the case, so when editing events from month view I made sure to add/change the time, but negected to look at "To" date.  If my event was for an hour, simply adding the hour pushed the day to span across dates so the event was really 25 hours.  Looked OK in the month view (just showed as a dot) but the day and week were all filled and casued the event to appear twice on the second day in list view (iPhone).  In the case of repeat events, sometimes "To" date ended up as the end date for the repeat cycle... which really messed every thing up... I believe causing what looked like duplicates, etc.

  • View (compare) multiple photos in Photos

    How do you view multiple photos at the same time in Photos (the new app)? In iPhoto, you could select the photos you wanted to compare and then click the Edit button to open them side by side with each other. I can't figure out what Photos wants me to do because, when you select more than one photo, you can't see the Edit button.

    I don't think you can, for a single photo you can compare before/after edit:

  • Select count in view question

    The sql view below does not do what I want it to and not sure which string function to use. The goal is to get the two columns with instr to only count the rows that the INSTR actually finds the string. Basically I am looking for a substring function that returns a boolean value and only count those when true. How I go about this in an oracle view.
    code:
    CREATE OR REPLACE VIEW LOGONREPORT
    AS
    SELECT USERNAME,
    COUNT(*) ATTEMPTS,
    COUNT(INSTR(ACTION,'LOG IN SUCCESS',1,1)) SUCCESS,
    COUNT(INSTR(ACTION,'LOG IN FAILED',1,1)) FAILED
    FROM AUDITRECORD
    GROUP BY USERNAME;
    --------------------

    Hi,
    for example:
    SQL> select ename, deptno from emp;
    &nbsp
    ENAME          DEPTNO
    SMITH              20
    ALLEN              30
    WARD               30
    JONES              20
    MARTIN             30
    BLAKE              30
    CLARK              10
    SCOTT              20
    KING               10
    TURNER             30
    ADAMS              20
    JAMES              30
    FORD               20
    MILLER             10
    &nbsp
    14 rows selected.
    &nbsp
    SQL> select deptno, instr(ename,'M') from emp order by 1,2;
    &nbsp
        DEPTNO INSTR(ENAME,'M')
            10                0
            10                0
            10                1
            20                0
            20                0
            20                0
            20                2
            20                4
            30                0
            30                0
            30                0
            30                0
            30                1
            30                3
    &nbsp
    14 rows selected.
    &nbsp
    SQL> select deptno,
      2  count(decode(instr(ename,'M'),0,null,instr(ename,'M'))) cnt
      3  from emp group by deptno
      4  /
    &nbsp
        DEPTNO        CNT
            10          1
            20          2
            30          2Rgds.

  • Unique counts - across a group by

    I am attempting to count unique patients that stay in the hospital. But they want the count by months. I only want the patient to count in the first month. is there a good way to do this.
    for example if I have a table like:
    CREATE TABLE "PATIENT_CHARGES"
         "SERVICE_DATE" DATE,
         "VISIT_NO" VARCHAR2(20 BYTE)
    Insert into PATIENT_CHARGES (SERVICE_DATE,VISIT_NO) values (to_date('01-JAN-12','DD-MON-RR'),'1');
    Insert into PATIENT_CHARGES (SERVICE_DATE,VISIT_NO) values (to_date('01-FEB-12','DD-MON-RR'),'5');
    Insert into PATIENT_CHARGES (SERVICE_DATE,VISIT_NO) values (to_date('01-FEB-12','DD-MON-RR'),'3');
    Insert into PATIENT_CHARGES (SERVICE_DATE,VISIT_NO) values (to_date('01-MAR-12','DD-MON-RR'),'5');
    Insert into PATIENT_CHARGES (SERVICE_DATE,VISIT_NO) values (to_date('01-JAN-12','DD-MON-RR'),'2');
    Insert into PATIENT_CHARGES (SERVICE_DATE,VISIT_NO) values (to_date('01-FEB-12','DD-MON-RR'),'4');
    and I run a query like:
    SELECT TO_CHAR(SERVICE_DATE, 'YYYYMM') AS SERVICE_CY_MONTH, COUNT(DISTINCT VISIT_NO)
    FROM PATIENT_CHARGES
    GROUP BY TO_CHAR(SERVICE_DATE, 'YYYYMM')
    I get:
    201201     2
    201202     3
    201203     1
    My total is 6. But I only have 5 patients. The 5th person stayed Feb - March . So although its a distinct count, it is by month, so they get double counted. What's my best way to get around this?

    Frank Kulash wrote:
    Hi,
    br**** wrote:
    Sorry its not really a unique patient identifier - that would be a medical record number, this is more a counter for each visit they have.Okay, so where I used visit_no, you should use whatever identifies the patient.Frank:
    Hopitals are odd places. In many ways, we do not care about patients, only visits (well, at least for counting/billing purposes). The medical reord number (MRN) uniquely identifies a patient across all of their interactions with the hospital, while a visit number uniquely identifies a particular interaction with the hospital. In most of the hopital systems I have seen patient is an attribute of visit, not the other way around.
    Certainly in my hospital, we would count distinct visits rather than patients. That is, if a patient with MRN 123 was here on visit number 9865 in February, and again on visit number 10023 in March, we would count that twice, but if visit 10023 extended into April, it would depend on the specific question being asked whehter we aould count that as one or two.
    John

  • Sharing context across views

    Hi.
    Each of the individual views (10+) in my WebDynpro application needs to know and display the same employee
    information about the logged-in user. Further, the user can enter the application from any one of the views. And once the application is entered, the user will likely visit several of the views.  My project structure is simple in that all of the views are contained within a single component.  To move from view to view, my code is invoking navigateAbsolute to another portal pcd location (iView) that invokes the target WebDynpro view.  By doing this, the portal navigation and the Webdynpro application orientation stay in sync.
    My goal is to store this shared information such that the application <u>only needs to retrieves the employee information ONCE per user session</u>.  In a J2EE application this type of information is generally stored in "session".
    Here are my questions:
    1. Do I need to store this employee information in a context "node", not a "value"?  Basically, how and where do I store this information to make it available across all views within the application?
    2. How do I programmatically check if a previous view has already invoked the RFC and populated the data in the shared session area?
    Thank you!
    Kevin

    Hi Kevin,
       <i>1. Do I need to store this employee information in a context "node", not a "value"? Basically, how and where do I store this information to make it available across all views within the application?</i>
      You can store this information as a value node in the component controller's context. By doing so all your views can access this value.
       <i>2. How do I programmatically check if a previous view has already invoked the RFC and populated the data in the shared session area?</i>
        You can check if the node size is zero or if it contains any elements. So once you have invoked the RFC, you will have to add a new element to this value node.
    Regards,
    Satyajit.

  • View compared PDF deleted text

    Hello!  After utilizing the Adobe Pro "compare" feature, how do you view the deleted text within the document (as opposed to only having access to it by resting the mouse on the revised text)?  Thank you!

    I believe you are referring to a service like this which would yes, enable you to view deleted texts...
    http://www.micromat.com/index.php?option=content&task=view&id=190

  • Possible to view/compare sidecar Jpeg?

    I shoot RAW+Jpeg because my camerea does very well with colors in the Jpeg.  I would like to be able to view the Jpeg within Lightroom and ideally compare it side-by-side with the RAW I am developing.  I know I can keep the files separate when importing but I do like having them linked in general.
    Is there anyway to view a sidecar Jpeg in Lightroom?  If not, I would love to see more work done to allow better management of sidecar Jpegs.

    AFAIK, there is no way to view a sidecar JPEG within LR. You'd have to import it seperately. Here is the place to put in feature requests, if you care that much about it.
    Beat

  • Is it possible to view/compare two Time Machine desktop dates at the same time?

    I accidentally lost a file on my desktop, inadvertently dragging it onto my browser. I don't know what file I lost, and would like to retrieve it through my Time Machine.  I don't want to replace all of the files on my desktop, but I would like to compare the files from two different dates (current date and last time saved) to discover the file I lost. If there's an easier way to make this discovery, I'm open for suggestions. Otherwise, I wonder if there's a way to see or compare my current   files on desktop vs. my last save to Time Machine (without printing out a list).
    Thanks in advance for your help!

    Hey apple_peeler,
    Thanks for using Apple Support Communities.
    It sounds like you want to find out what is now missing by comparing it with other backups. The Restoring data from Time Machine backups section explains how you can do that.
    Mac Basics: Time Machine backs up your Mac
    http://support.apple.com/kb/HT1427
    You can use the timeline on the right side of the window to reach a certain point back in time. The timeline shows the times of all backups on your backup drive. If you don’t know exactly when you deleted or changed a file, you can use the back arrow to let Time Machine automatically travel through time to show you when that folder last changed.
    Have a nice day,
    Mario

Maybe you are looking for