Solved

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

Posted on 2013-10-31
2
289 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

821 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