February 12, 2013 at 6:15 am
Here's an example list. I need to exclude this MRN from my query because it contains the value 250.
MRN ICD9Code
123456 245
123456 432
123456 250
123456 123
February 12, 2013 at 6:22 am
NineIron (2/12/2013)
Here's an example list. I need to exclude this MRN from my query because it contains the value 250.
MRN ICD9Code
123456 245
123456 432
123456 250
123456 123
the explanation may be overly simplified, but wouldn't a simple WHERE statement do what you are asking?
SELECT *
FROM YOURLIST
WHERE ICD9Code <> 250
or do you mean something like this:
SELECT *
FROM YOURLIST
WHERE MRN NOT IN(SELECT MRN FROM YOURLIST
WHERE ICD9Code = 250)
Lowell
February 12, 2013 at 6:33 am
The second one, yes.
Thanx.
February 12, 2013 at 7:33 am
Lowell (2/12/2013)
NineIron (2/12/2013)
Here's an example list. I need to exclude this MRN from my query because it contains the value 250.
MRN ICD9Code
123456 245
123456 432
123456 250
123456 123
the explanation may be overly simplified, but wouldn't a simple WHERE statement do what you are asking?
SELECT *
FROM YOURLIST
WHERE ICD9Code <> 250
or do you mean something like this:
SELECT *
FROM YOURLIST
WHERE MRN NOT IN(SELECT MRN FROM YOURLIST
WHERE ICD9Code = 250)
Or perhaps this:
SELECT
*
FROM
YOURLIST yl1
WHERE
NOT EXISTS(SELECT 1 FROM YOURLIST yl2 WHERE yl2.ICD9Code = 250 and yl2.MRN = yl1.MRN)
February 12, 2013 at 7:39 am
Lynn Pettis (2/12/2013)
Lowell (2/12/2013)
NineIron (2/12/2013)
Here's an example list. I need to exclude this MRN from my query because it contains the value 250.
MRN ICD9Code
123456 245
123456 432
123456 250
123456 123
the explanation may be overly simplified, but wouldn't a simple WHERE statement do what you are asking?
SELECT *
FROM YOURLIST
WHERE ICD9Code <> 250
or do you mean something like this:
SELECT *
FROM YOURLIST
WHERE MRN NOT IN(SELECT MRN FROM YOURLIST
WHERE ICD9Code = 250)
Or perhaps this:
SELECT
*
FROM
YOURLIST yl1
WHERE
NOT EXISTS(SELECT 1 FROM YOURLIST yl2 WHERE yl2.ICD9Code = 250 and yl2.MRN = yl1.MRN)
Or even this
SELECT *
FROM YOURLIST Y
LEFT JOIN YOURLIST as YL on YL.ICD9Code = 250
WHERE YL.ICD9Code IS NULL
February 12, 2013 at 7:53 am
Thanx for your input.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply