简体   繁体   中英

Formula picking up almost all values

I am retrieving the following values but it is not consistent. I need the values after the GESTATIONAL AGE:. Sometimes it picks up after sometimes it does not. The following are the values being returned. Sometimes it contains Gestational Age, sometimes is does not . I do not want the words Gestational Age. I just want 37w3d etc.

 Gestational Age: 37w3d

  39w6d

  39w0d

  34w6d

  41w0d 

  Gestational Age: 39w5d 

I have tried to 'tweak' the substr but it can't pick up the string consistently

I am using the following formula to pick up my values but it is not working on all of them

select SUBSTR(a.note_text, 
       INSTR(a.note_text,'Gestational Age:')+17, 
       INSTR( 
           SUBSTR(a.note_text,INSTR(a.note_text,'Gestational Age:')+17) , 'd')+1 ) as GA
from 
table

Is it maybe as simple as using a REPLACE?

select REPLACE(a.note_text,'Gestational Age: ','') as GA
from 
table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM