Hi Buddy,here is what i tried
bro (max(rdate_)) patnumbr cptcode service from todo0 group by rdate_ patnumbr 
cptcode service

instead of giving me just the last test, it gives me every test, as if it is 
ignoring the MAX function
What am I doing wrong?
Mike

      From: Buddy Walker <[email protected]>
 To: [email protected] 
 Sent: Monday, October 12, 2015 8:54 PM
 Subject: [RBASE-L] - RE: extracting the most recent data
   
<!--#yiv0759764450 _filtered #yiv0759764450 {font-family:"Cambria 
Math";panose-1:2 4 5 3 5 4 6 3 2 4;} _filtered #yiv0759764450 
{font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}#yiv0759764450 
#yiv0759764450 p.yiv0759764450MsoNormal, #yiv0759764450 
li.yiv0759764450MsoNormal, #yiv0759764450 div.yiv0759764450MsoNormal 
{margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New 
Roman", serif;}#yiv0759764450 a:link, #yiv0759764450 
span.yiv0759764450MsoHyperlink 
{color:#0563C1;text-decoration:underline;}#yiv0759764450 a:visited, 
#yiv0759764450 span.yiv0759764450MsoHyperlinkFollowed 
{color:#954F72;text-decoration:underline;}#yiv0759764450 
span.yiv0759764450EmailStyle17 {font-family:"Calibri", 
sans-serif;color:#1F497D;}#yiv0759764450 .yiv0759764450MsoChpDefault 
{font-size:10.0pt;} _filtered #yiv0759764450 {margin:1.0in 1.0in 1.0in 
1.0in;}#yiv0759764450 div.yiv0759764450WordSection1 {}-->Mike  You could try    
 SELECT  MAX(datecolumn), patientnumber,testcode from sometable group by 
patientnumber, testcode, datecolumn  Buddy  From: [email protected] 
[mailto:[email protected]] On Behalf Of Michael J. Sinclair
Sent: Monday, October 12, 2015 8:23 PM
To: [email protected]
Subject: [RBASE-L] - extracting the most recent data  Hi all  I have a very 
long skinny table, 3 columns. 
A date, a patient number and test code.  I want to extract the rows that are 
the most recent test code for each patient.  If patient #3000 has had testcode 
# 80015 10 times over the last year, then I only want the most recent row for 
that testcode/patient combination  Is there a single command that can do that?  
Mike

  

Reply via email to