Thursday, March 8, 2012

Complicated count w/ subquery

Site Patient Visit
Number Number Number
1 1 1
1 1 2
1 2 1
1 3 1
2 1 1
2 2 1
3 1 1
3 1 2

Site Number 1 has 2 visit 1 and 1 both (visit 1 and visit 2)
Site number 2 has 2 visit 1
site number 3 has 1 both (visit 1 and visit 2)

I am really confused as to how to accomplish this in one query. I can query it sep, but not together. Ultimately, I am looking for either visit 1, visit 2, or both, but there should not be duplicates (that is the problem I am having because once counted, it should not appear in any other count)Perhaps if you asked a question the forum would be more responsive.|||Post the query you are currently using. At a guess I would say you are missing some Group By clause.

Mary

No comments:

Post a Comment