Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-10-31
2
Medium Priority
?
293 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 2000 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

Independent Software Vendors: 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

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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…

660 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