how to write the full statement?

By Art222 ·
Find the patient identification number and the rounded average of RBC, WBC, PLT (by 1 decimal) which have been entered in the first half of 2005 and with WBC greater than 9. Show only the Patient's identification number, RBC, WBC, PLT and the Date of the laboratory result.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Homework? Nt

by PurpleSkys In reply to how to write the full sta ...
Collapse -

Reponse To Answer

by Art222 In reply to Homework? Nt
Collapse -

Reponse To Answer

by PurpleSkys In reply to Homework? Nt

more you're using...OS...what you're trying to do? because to me the whole question sounds like it's taken directly out of a textbook.

Collapse -

Reponse To Answer

by dcolbert Contributor In reply to Homework? Nt

That looks like exactly what the question-asker has done here.

Looks like they're looking for a select statement that will return a bunch of ePHI from a database containing medical records, and they only want integer and date-format responses. I bet it is a pretty easy query to write, if you know SQL and make some assumptions about the fields based on the names supplied in the example.

Collapse -

Here is one possible way...

by dcolbert Contributor In reply to how to write the full sta ...

This seems like it would do the trick:

select patient_identification_number
, CONVERT(decimal(18,1), SUM(RBC) / COUNT(RBC)) as AVG_RBC
, CONVERT(decimal(18,1), SUM(WBC) / COUNT(WBC)) as AVG_WBC
, CONVERT(decimal(18,1), SUM(PLT) / COUNT(PLT)) as AVG_PLT
, Lab_Result_Date
from patient_info_table
where Lab_Result_Date >= '01/01/2005' and Lab_Result_Date < '07/01/2005'
and WBC > 9
group by patient_identification_number

But if you don't understand why - you probably shouldn't submit it as your answer - because there are already enough people like that in the industry as it is, anyhow.

Props to an app/SQL developer I know for throwing this together for me.

And really - here is my point... I'm not even *remotely* a coder or developer. If the logic required to make this statement in SQL, Java, C++, Visual Basic or any other development or scripting language escapes you - you might be barking up the wrong tree in your career development. Don't chase after coding because you think it'll be good money if you don't have the mindset for it. But if you can read the code above and the light goes on for you and you can at least understand in an abstract sense what is going on there... then by all means keep on.

Related Discussions

Related Forums