Filtering with the maximum of a date

Hello

I have this request

SELECT
  PM.PATIENT_FILE_NO,
  PE.EPISODE_NO,
  
 PATIENT_NAME_2_P
 MR.VISIT_DATE
FROM
  RC_PATIENTS PM,
  RC_PATIENT_EPISODES PE,
  AD_PATIENT_ADMISSIONS PA ,
  MR_PATIENT_VISITS MR
WHERE
  PM.PATIENT_FILE_NO   =PE.PATIENT_FILE_NO
AND PE.ADMISSION_NO    =PA.ADMISSION_NO
AND PM.PATIENT_FILE_NO =MR.PATIENT_FILE_NO
AND PE.STATUS         != 'C'

the 'mr.visit_date' column got the date of the patient's visit, because

the same patient may go to the hospital more than once,

I want each patient with his last visit,

How to do?

Thank you

  • SELECT
  • H. PATIENT_FILE_NO,
  • PE. EPISODE_NO,
  • PATIENT_NAME_2_P
  • MR. VISIT_DATE
  • Of
  • RC_PATIENTS H,
  • RC_PATIENT_EPISODES PE,
  • PA AD_PATIENT_ADMISSIONS,
  • MR. MR_PATIENT_VISITS
  • WHERE
  • H. PATIENT_FILE_NO IS PE. PATIENT_FILE_NO
  • AND PE. ADMISSION_NO = PA. ADMISSION_NO
  • AND H. PATIENT_FILE_NO = MR. PATIENT_FILE_NO
  • AND PE. STATUS! = « C »
  • and mr.visit_date = (select max (visit_date) of MR_PATIENT_VISITS)

I think it should be

and mr.visit_date = (select max (visit_date) of mr_patient_visits

where mr.patient_file_no = pm.patient_file_no

Tags: Oracle Development

Similar Questions

  • What is the maximum number of data warehouses in a system of Vcenter?

    What is the maximum number of data warehouses in a system of Vcenter?

    I had a look at highs of configuration in http://www.VMware.com/PDF/vSphere4/R40/vsp_40_config_max.PDF , he lists100 in the section of SMI-S

    SMI-S section list max number of ESX host as 100, although it is 300 in the maximum of vcenter server. Should I look for in the section of SMI-S?

    Only if you plan to use SMI - if she does not go with the maximum rates for vCenter - and you are correct to look at the number of hosts since it is the ESX hosts that communicate to the SAN not vCenter-

  • Is there a problem with the maximum size of the RAM for Satellite 320CDT?

    I have a 320CDT Satellite with the latest BIOS (v8.00) and Windows 98 Second edition installed. There are 32MB memory base and a 32 MB module in the single expansion slot. If I change it to a plug-in 64 MB I see that 64 MB of total memory reported, not 96 as expected; the specification for the machine indicates that the admissible maximum memory is 160 MB (32 MB base + 128MB expansion). Does anyone know if there is a problem with the maximum memory size for this model and if there is a solution or workaround? I need to know quickly, in order to decide if I should return the memory module to the vendor! Thanks a lot for any help, Peter

    Satellite 320CDT supports an internal memory of 32 MB and a single slot can be used!
    You can improve it to max 96 MB (32 + 64 MB)
    I found a few old memory modules. You can use the modules SODIMM 144 pin EDO PA2043U 32 MB or 64 MB PA2044U

    Greetings

  • Event ID: 7024 with error message: "the Windows Firewall service stopped with the error service specific data are invalid.

    Original title: cannot start Service Windows Firewall: Error Code 13

    Hello.

    Anyway, the Action Center has begun randomly telling me that the Windows Firewall is disabled. When I try to start or return to the default settings, it tells me that it is not able to do.

    I went to Services and Windows Firewall is set to automatic, but it is not started. I try to start it and it tells me that it is not able to do the same. The error code is 13.

    I am an administrator.

    MalwareBytes did find and delete a virus named "Disable.SecurityCenter", but after removing that I am still unable to start the Service.

    Can someone help with this problem?

    Edit: The journal ID is 7024 and description:

    "The Windows Firewall service stopped with the error service specific data are not valid... '. ».

    Hello, Connor

    You can try to perform a system restore to before that the problem started. For instructions on how to proceed, see the following ink: System Restore: frequently asked questions

    You can also try running a SFC scan to check (and repair) system corrupt/modified files. To do this, go to start, all programs, accessories, click with the right button on command prompt and choose Run as administrator. In the command prompt, type the following command and press ENTER: SFC/scannow

    David
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • "Filtering exceeds the maximum time" error in the crawl log

    A track log contained the following error. Is this error related to the Configuration of robot setting "Crawler Timeout (seconds) threshold? (Mine is set * 30 * seconds.)

    "Filtering exceeds the maximum time * 108 * seconds; killed process. dating status 1 without any error message.

    No, they are not related. Filtering is the process of conversion to the format (Word, PDF) documents into searchable text. If it exceeded the 108 seconds the process had almost certainly hanged, most likely indicating a corrupt file.

  • storage iCloud became moot with the old credit card data. Can I recover my data?

    I've been a subscriber of the additional 200 GB of storage iCloud. I accidentally let it expire with the old data of credit card on my account and he knew only a few days later. I've updated my credit card information and resibscribed, but it seems that I lost all my data previously in my iCloud. Is this correct? Is there anyway to recover my data?

    30 days.

    You receive a notification of the warning that you know how long it will take before your data is deleted, if you let it go since it is not recoverable.

  • DateField with a maximum limit of date

    Hello

    How to set a maximum limit of date in a datefield. That is, user will not be able to choose the date that exceeds the maximum limit.

    You have determined and as suggested earlier in this thread, DateField does not provide a maximum or minimum you have to apply this restriction externally, using a FieldChangeListener or another control mechanism.  So, I think you can mark this as resolved.

  • Update of CRMI against COE Oracle 10 G server fails with the error message Invalid Date of creation

    I have an application that performs an update of a piece of content via CRMI. The element is specified viaA content ID. Since UPDATE_DOCINFO is the service DOC_INFO needs service is executed first to get it.

    DOC_INFO returns information very well. However, when UPDATE_DOCINFO is executed, it always seems to return an error message stating that creation Date is not valid. The element content updates without this error via the Native Web INTERFACE. My code works when pointed at an Oracle 11 G Server COE.

    I tried:

    1. Adding did so to a new DataBinder, without dCreateDate
    2. Adding did so to a new DataBinder, with dCreateDate
      • Add dCreateDate as a date object (from DOC_INFO response I've tried)
        • through thegetDate()
        • manual conversion with DataObjectEncodingUtils.decodeDate() (w / get() )
      • Add a string
        • convert with SimpleDateFormatter similar to how RIDC encodes (w / getDate() )
        • manual conversion with DataObjectEncodingUtils.encodeDate() (w / getDate() )
        • as «»
        • as null
        • get()Instead ofgetDate()
    3. Directly using DOC_INFOresponse Binder
    4. With the help of the library of CRMI 11 G (3 above) 5 using the RIDC 10 G (1-3 above) library

    All listed approaches have returned the same error message.

    Here's the method I use for the update. The commented code is the thing I've tried that does not resolve the issue.

    public ServiceResponse executeByContentId (String szContentId, map < String, String > updateHMap)

    throws RemoteException

    {

    If (log.isDebugEnabled ())

    {log.debug ("the execution of an update:" + szContentId) ;}}

    get the RIDC context - guess the context RIDC has already been created.

    IdcContext = RIDCApp.IDC_CONTEXT_LIST.get context (getUsername ());

    Download the client

    Customer IdcClient = RIDCApp.IDC_CLIENT;

    create the command object to run

    DataBinder dataBinder = client.createBinder ();

    film for convenience

    Binding EDAMDataBinderWrapper = new EDAMDataBinderWrapper (dataBinder);

    Binder. DOC_INFO_BY_NAME();

    binder.putDDocName (szContentId);

    binder.putRevisionSelectionMethod (RevisionSelectionMethod.Latest);

    ServiceResponse rawResponse = null;

    Try

    {

    log.info ("About to RUN: (previous update) \n" + binder.toString () ");

    rawResponse = client.sendRequest (context, binding);

    DataBinder responseBinder = rawResponse.getResponseAsBinder ();

    log.info ("Found: (previous update) \n" + responseBinder.toString () ");

    used to get the result

    EDAMDataBinderWrapper docInfoResult =

    EDAMDataBinderWrapper (responseBinder) new;

    //used for the update

    EDAMDataBinderWrapper updatebinder =

    EDAMDataBinderWrapper (client.createBinder ()) new;

    //new EDAMDataBinderWrapper (responseBinder);

    //required fields!

    DocInfoSet of the DataObject = docInfoResult.getResultSet ("DOC_INFO")

                                                                            .getRows () .get (0);

    updatebinder.putLocal ("dDocName", szContentId);

    updatebinder.putLocal ("a", docInfoSet.get ("dID"));

    updatebinder.putLocal ("dRevLabel", docInfoSet.get ("dRevLabel"));

    updatebinder.putLocal ("dSecurityGroup", docInfoSet.get ("dSecurityGroup"));

    updatebinder.putLocal ("dDocAccount", docInfoSet.get ("dDocAccount"));

    //updatebinder.putLocal ("dCreateDate", docInfoSet.get ("dCreateDate"));

    //updatebinder.addDate ("dCreateDate", docInfoSet.getDate ("dCreateDate"));

    //updatebinder.putLocal ("dCreateDate", "");

    //updatebinder.putLocal ("dCreateDate", null);

    //updatebinder.putLocal ("dCreateDate", docInfoSet.getDate("dCreateDate").toString ());

    DCreateDate //Date = docInfoSet.getDate("dCreateDate");

    / * BEGIN - Encoder Date average Java * /.

    //example format: 2012-05-16 15:35

    SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-DD kk:mm:ss");

    updatebinder.putLocal ("dCreateDate", sdf.format (dCreateDate));

    //END - encoder Date average Java * /.

    / * BEGIN - Encoder Date Oracle COE medium * /.

    updatebinder.putLocal ("dCreateDate",

    DataObjectEncodingUtils.encodeDate (dCreateDate));

    //END - code way Date Oracle COE * /.

                    /*

    String dCreateDateString = docInfoSet.get("dCreateDate");

                    try

                    {

    updatebinder.addDate ("dCreateDate",

    DataObjectEncodingUtils.decodeDate (dCreateDateString)

                                                    (. getTime());

                    }

    catch (ParseException exception ignored) End Sub

                    */

    String xAssetSubType = docInfoSet.get("xAssetSubType");

    //log.debug ("setting in"xAssetSubType":" + xAssetSubType);

    updatebinder.putLocal ("xAssetSubType", xAssetSubType);

    / / Set the values of metadata

    for (String szFieldName: updateHMap.keySet ())

    {updatebinder.putLocal (szFieldName, updateHMap.get (szFieldName)) ;}}

    updatebinder. UPDATE_DOCINFO(); to say the next request to perform the update

    //now that we have result - try the update

    Return the response of update of the document

    log.info ("About to RUN: (updated) \n" + updatebinder.toString () ");

    If (log.isDebugEnabled ())

            {

    log.debug ("update fields");

    for (entry entry < String, String >: updatebinder.getLocalData () .entrySet ())

                    {

    log.debug ("Update: '" + entry.getKey () + "' to '" + entry.getValue () + "'" "");

                    }

            }

    ServiceResponse response = client.sendRequest (context, updatebinder);

    log.info ("Found: (updated) \n" ")

    + response.getResponseAsBinder () m:System.NET.SocketAddress.ToString ());

    return response;

            }

    catch (Cie IdcClientException)

            {

    log.error ("Error updating the Document", sea ice);

    //throw new RuntimeException ("Error updating the Document", sea ice);

    //throw new RuntimeException ("error updating the Document-" + ice.getMessage (), ice);

    throw RuntimeException (ice.getMessage () new, ice);

            }

    //something gone wrong

    //return null;

    }

    I could solve the problem.

    The answer is proven be setting the parameter UserDateFormat on the RIDC Binder that I used to make the update request.

    Then I got just to make sure that all of my dates been serialized using this same format.

  • Shock wave of trouble with the structure of multidimensional data list

    I have the following fairly simple code. Shockwave throws an error executing non-descript and shut unexpectedly on glTireData [symbol (myBrandSymbol)] .count () and I'm sure she would have trouble with the following line, if he ever had of him. The code works correctly in a standard projector as well as in the authoring environment. I had a look on the variables using the debugger and everything is as it should be, the following short example (the complete data structure glTireData is much larger, but it is an example of the format):

    myBrand = "Firestone".
    myBrandSymbol = "Firestone".
    glTireData = [#Firestone [#FD690PLUS [#tireBrand: 'Firestone', #tireDesign: 'FD690 PLUS', #feFactor:169.35, etc...]]]

    My bad... the initial project used PrintOMatic and I had already removed the functions of POM (we knew that it was not sure Shockwave) except that I neglected the xtra registration in Manager startMovie... just below the registration code has the code to load my tire reinscriptible... apparently the registration code has been stop startMovie Manager prior to the loading of the data structure by simply removing the code reg cured the problem.

  • Facing the question with the Maximum number of connections Timesten

    Hello

    In my project, I need to increase the maximum number of connections that timesten offers me. So, I changed the setting of the nucleus as shown below in the file/etc/sysctl.conf.

    kernel.SEM = 655 670720 128 1024

    The intention here is to get 500 connections max. But even after this setting too, I get only 477 connections. I don't understand why this is happening. Someone help me understand what is happening here.

    In above configuration, my hypothesis is that 155 semaphores are reserved for internal use of timesten and remaining 500 will be available for me, but this isn't the case. Please, help me in this aspect to understand why I get only 477 connections instead of 500 connections.

    Quick help is very appreciated

    Thank you

    Agnes

    Hi Agnes,.

    Thanks for the release of ttStatus. He explains what is happening and confirms my suspicions (second).

    The setting of the 'Connections' in the DSN attribute defines the limit superior on user connections; that is, connections by applications and tools such as ttIsql, ttMigrate etc etc. There is also the concept of connections 'system' (subdaemon, replication agent, agent of cache etc) that do not count against the total "Connections."

    In your case, the database is in fact properly configured for a maximum of 500 user connections. However, as you can see on the first ttStatus, you already have 23 application direct mode of 4 different connections methods of Java (which leaves the available user 477 connections). I of course have no idea what these applications are but probably your. This means that you are able to open additional connections a 477 application before arriving to the configured limit of 500. And that's exactly what we see; When you run your test application (what happens to connect via client/server), it reached 477 connections and then impossible to create more. As expected.

    Therefore, to allow connections you must:

    1. stop the database (replace ramPoilicy by manual (or inUse), stop all applications, stop the replication agent, unload from memory if the policy is manual)

    2. change the value for connections in the attributes of the DSN to a higher value (perhaps 600) - also, you need to make sure that OS semaphores are high enough to allow this number of connections.

    3. load the database back in memory, start the replication agent, starting applications.

    A a tied note, use of ramPolicy 'always' is not encouraged. In addition to the scenarios 'manual' is a better choice. We can "always" deprecated in a future release.

    Chris

  • Select the lines with the maximum value for a date where another column is different from 0

    Hello

    I need to write a query on a table (called DEPRECIATION) that returns only the rows whose date maximum (PERENDDAT_0 column) for a specific record (identified by AASREF_0), and where the other column in the table called DPRBAS_0 is different from 0.

    If DPRBAS_0 is equal to 0 in all the lines of a specific record, then return the line with date maximum (PERENDDAT_0 column).

    To be clearer, I give the following example:

    Suppose we have the following data in the table of DEPRECIATION:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001074331/12/20140
    I2011001074331/12/20130
    I2011001085612/31/20160
    I2011001085631/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445
    I2014001223831/12/2015445
    I2014001223831/12/20140

    The query must return only the following lines:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445

    Thanks a lot for your help!

    This message was edited by: egk

    Hello Egk,

    The following query works for you.

    SELECT AASREF_0, PERENDDAT_0, DPRBAS_0

    FROM (SELECT AASREF_0,

    PERENDDAT_0,

    DPRBAS_0,

    ROW_NUMBER)

    DURING)

    AASREF_0 PARTITION

    ORDER BY

    CASE WHEN DPRBAS_0 <> 0 THEN 1 OTHER 0 END DESC,.

    PERENDDAT_0 DESC)

    RN

    DEPRECIATIONS)

    WHERE rn = 1

  • Get surveys using filtered with the ID (space) data control manager surveys

    Hi all

    I need to get surveys using surveys Manager DataControl a space specific webcenter. I did not find any function under the control of data for surveys Manager for passing the scopeId as argument parameter.

    Is it possible to filter the polls based on the id of the scope?

    Can someone help me?

    Kind regards
    Suma

    According to the documentation.

    http://docs.Oracle.com/CD/E17904_01/WebCenter.1111/e10148/jpsdg_polls.htm#CIHIIJHG

    There is no scope ID to filter the polls based on spaces.

    But in any case, to achieve your desired goal, I would say that...

    Create surveys Mutiple (surveys) and on each Survey (Polls) you can have questions to take the poll.

    Thus,.

    Space 1-> 1-> Question 1 survey

    Space2-> eurobarometre2-> issue 1

    Space3-> poll3-> Question 1.

    All by posting the question you can use take survey taskflow or datacontrol where you will need to provide a SURVEY_ID in the pollId parameter.

    I hope that clarfiies your request.

    Kind regards
    Hoque

  • Obtain registration with the maximum Date within a group

    People,
    Need to find the file that has the most recent date. Here's what the table looks like:
    desc student_ldg;
    
    account_number   not null   varchar2(10)
    dept_code        not null   varchar2(5)
    assignment_date  not null   date
    We had to find the last record in the table that has the largest assignment_date.

    Any help is appreciated.

    Thank you

    Which version of DB you are working on?

    Try this

    select *
      from (select * From student_ldg order by assignment_date desc)
     where rownum = 1;
    
  • ITS filter - adding several filters with the same custom attribute

    Hello

    I added the attributes of custom search and am able to add a filter to the doOracleSearch method.

    filter [0] = new filter (New Integer (100), 'NUMBER', 'equal', 10020);

    Now I have to add another filter for the same attribute of research with or condition, how can I do this...

    I tried the following...

    filter [0] = new filter (New Integer (100), 'NUMBER', 'equal', 10020);
    filter [1] = new filter (New Integer (100), 'NUMBER', 'equal', 10049);

    But how do I specify it's or and the code above does not work.

    Thank you.
    Vermorel.

    Here is an example of this using 11 g. Note that you need to connect programmatically if the data is secure.

    Create the search service and to define the URL of SOAP
    SearchService OracleSearchService = new OracleSearchService();
    searchService.setSoapURL ("http://myserver:7777/recherche/requete/oraclesearch"); ")

    Download the data to the research group
    DataGroup dataGroup = new DataGroup();
    dataGroup.setGroupName ("MyGroup");
    DataGroup dataGroups [] = new DataGroup [1];
    dataGroups [0] = dataGroup;

    Get a list of all the attributes to fetch
    Attribute [] attributesAll = searchService.getAllAttributes("en");
    ArrayList attributeIds = new ArrayList ();
    for (attribute a: attributesAll)
    {
    attributeIds.add (a.getId ());
    }
    Integer [] attributeIdArrayAll = Integer [attributeIds.size (new)];
    attributeIdArrayAll = attributeIds.toArray (attributeIdArrayAll);

    Create filters (BE sure THAT THE FILTER ID IS CORRECT - I do not pretend you code it but rather browse the list of all of the above attributes and get ID like that)
    Filter [] myFilters is new filter [2];.
    myFilters [0] = new filter (124, "Number", "EQUAL", "129224");
    myFilters [1] = new filter (124, "Number", "EQUAL", "123730");

    Request (be SURE to USE ' or ' as the operator between the filters)
    Result OracleSearchResult = searchService.doOracleSearch ("", 0, 50, false, false, dataGroups, "fr", null, true, 'or', myFilters, attributeIdArrayAll);

    Get number
    int hits = result.getEstimatedHitCount () .intValue ();

    Print results
    ResultElement [] resElements = result.getResultElements ();
    for (int i = 0; i)< reselements.length;="">
    {
    Download the document
    ResultElement doc = resElements;
    }

    I hope this helps!

  • problem with the files of exported data after conversion from 10.1 to 10.3 OPA OPA

    Hello

    If all goes well a relatively simple question

    We have recently acquired access to the OPA 10.3

    We have previously developed a 10.1 modules which we imported 10.3 using the upgrade features. This one is designed to be an interface from machine to machine and as such is entirely dependent on the Fed data to make decisions, there is no question screens or interviews.

    Then, we have tried to import some ".xds" files we had created to 10.1. There are more than 160 of them, including in general more than 120 items of data in each with multiple entities and bodies.

    When we import in 10.3 you get an error message which reads:


    + "System.NullReferenceException: object reference not set to an instance of an object." +

    + Oracle.Determinations.Remote2.Util.LegacySessionDataXDSImporter.ReadEntity (XMLStreamReader reader) +.

    + Oracle.Determinations.Remote2.Util.LegacySessionDataXDSImporter.ReadSessionData (XMLStreamReader reader) +.

    + Oracle.Determinations.Remote2.Util.SessionDataXDSUtils.ImportSession (SessionData sessionData, Rulebase rulebase File xmlFile) +.

    at Oracle.Modelling.Debugger.Core.UI.DebuggerRunView.btnImport_Click (Object sender, EventArgs e) + ' + '.

    the simple solution is for us to reintroduce the '.xds' files in the debugger, but given that it it took over 2 weeks for our team at the entrance of the '.xds' in the first place, we would obviously like to explore other options first!

    Any help or ideas would be greatly appreciated

    See you soon

    Dave

    Hi Dave,.

    I have this working on the copy of the modules I've had, it's because your entity / relationship public names do not match the .xds, probably because of the upgrade file. I sent you an email on this subject.

Maybe you are looking for