Solved

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

Posted on 2013-10-31
2
287 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
Comment Utility
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
Comment Utility
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.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
CREATE TABLE syntax 4 44
JDeveloper 12c for 32 bit 4 34
T-SQL Convert to PL/SQL 23 60
Error executing command from server 6 26
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now