Subject distinct in join
Author Alejandro Garcia
Hi! I have table A:  PatId  Date Country
and table B: PatId Unit Code
 
I need to join them by PatId with a condition in the Date field and show the results with no repeated PatIds,
 
This is not working:
 
Select DISTINCT(PatId), Date, Country, Unit, Code
from A
 JOIN B ON (A.PatId=B.PatId)
  where (A.Date >= 01/01/2008 and A.Date <= 31/12/2008)
order by PatId
 
I tried to group by and then select distinct by it's not working, how could I select distinct?
Sorry for this question that seems to be too easy but can't solve it...




[Non-text portions of this message have been removed]