We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How to exclude row with date

lcalabro
lcalabro asked
on
Medium Priority
266 Views
Last Modified: 2012-05-11
I need to exclude data rows that have same auth_no when the discharge date is not null in any row.
So in the example below, all the rows with auth_no = 200 should be excluded because the last row has a discharge date.  The report should only display the first row of data where auth_no = 100.   Any sql help would be appreciated.

Service Date      auth_no      Discharge
1/5/2011      100      NULL
1/14/2011      200      NULL    --should be exluded
1/18/2011      200      NULL    --should be excluded
1/20/2011      200      NULL    --should be excluded
2/4/2011      200      1/22/2011  -- all auth_no = 200 should be excluded as discharge date is not null in this row.
Comment
Watch Question

Software Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Alpesh PatelSolution Architect at TCS (SAFe®Agilist, TOGAF® Foundation, PSM I®, MCP, MCSD)
CERTIFIED EXPERT

Commented:
Select * From Table where  auth_no <> 200

Author

Commented:
thank you!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.