![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
select PatientName, PatientID, PatientDOB from MyTable; now this works but there is a row generated for each exam in the table. How do I make this DISTINCT for each PatientID? |
#3
| |||
| |||
|
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Indeed the table was not properly normalized.. unfortunately.. but you know what they say, "There is never time to do it right, but there is always time to do it over!". I've heard that bogus statement many time myself. I always ask, "If you don't have time to do it right, |
|
I think my problem is more that I'm not sure how DISTINCT works. |
#6
| |||
| |||
|
|
I have a select statement that needs some refinement. select PatientName, PatientID, PatientDOB from MyTable; now this works but there is a row generated for each exam in the table. How do I make this DISTINCT for each PatientID? |
#7
| |||
| |||
|
|
"SpreadTooThin" <bjobrien62 (AT) gmail (DOT) com> wrote in message news:16597895.1120.1327952670631.JavaMail.geo-discussion-forums (AT) prhz38 (DOT) .. I have a select statement that needs some refinement. select PatientName, PatientID, PatientDOB from MyTable; now this works but there is a row generated for each exam in the table. How do I make this DISTINCT for each PatientID? Can you clarify what it is that you would like to get? I wonder whether its not "distinct" but "group by" that you might be after. In any event if you could give an example of what you would like to get out from your query then that would help others help you. |
#8
| ||||
| ||||
|
|
Indeed the table was not properly normalized.. unfortunately.. but you know what they say, "There is never time to do it right, but there is always time to do it over!". |
|
I think my problem is more that I'm not sure how DISTINCT works. Does it look at the entire returned record set and remove duplicate rows? |
|
Assuming you have a table like: X y Z A, B, C A, B, C A, A, C A, A, A A, A, A |
|
select DISTINCT X, Y, Z FROM table; A, B, C A, A, C A, A, A is this different than select DISTINCT(A), B, C from table; A, B, C |
#9
| |||
| |||
|
|
I have a select statement that needs some refinement. select PatientName, PatientID, PatientDOB from MyTable; now this works but there is a row generated for each exam in the table. How do I make this DISTINCT for each PatientID? |
![]() |
| Thread Tools | |
| Display Modes | |
| |