Solved

Adult Care - Finding out the difference between Begin Date and Ending Date

Posted on 2013-10-31
2
288 Views
Last Modified: 2013-11-07
Hello,
I had previous help on a question asked and the query provided works pretty good, but still needs a little tweaking.
The issue is that I need to find out the max end date and the min end dates of a case and then do a subtraction of them, to see if there is a difference.
The initial question used the wrong dates but as you can see in the attached spreadsheet,
it shows rows for each case.
Please take a look at case '0000069470'.  I want to show on 1 row, not multiple rows:
TID_DATE_BEGIN = '12/31/2012'
TID_DATE_END = '12/17/2012'
(I hi-lited the dates on the .xls file, that I want to see for each case and also, to find the difference)
So the difference will be a 'Y', based on the attached query.  And should be a 'N' for the other 2 cases...  Right now, the other 2 cases show a 'Y' and that is not correct.
Is there something else I can do to correct this?

Attaching query and results from running the query.
Thanks.

Using Oracle 11g
AdultCare.xls
TestQuery.sql
0
Comment
Question by:Machinegunner
2 Comments
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 500 total points
ID: 39617505
Try this:
SELECT caseno, MAX ( tid_date_begin), MIN ( tid_date_end)
  FROM (
       -- 
       -- Your query that produces the spreadsheet data 
       -- 
      )
GROUP BY caseno
ORDER BY caseno
/

Open in new window

:p
0
 

Author Closing Comment

by:Machinegunner
ID: 39631718
Thanks!  That worked and appreciate the reply and input.
Thanks again.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question