Solved

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

Posted on 2013-10-31
2
290 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sybase and replication server 13 82
add more rows to hierarchy 3 46
oracle collections 2 42
replicate in oracle 13 45
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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 setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

734 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