If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Sql Query for multiple texts - Which Forum

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-29-08, 11:52
cappertan cappertan is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
Question Sql Query for multiple texts - Which Forum

Hi:
I am querying a varchar column.
My goal is to save the percentage following 'ejection fraction' as part of the query results.
Text being queried looks like>> LEFT VENTRICLE: Overall systolic function appears normal. Fractional shortening is 43%. Estimated ejection fraction is 65%-70%.
I need to meet the 2 conditions: a) Find 'LEFT VENTRICLE' and b) find 'ejection fraction'. If I use a '%' wildcard to find 'LEFT VENTRICLE', can I\should I substring? or use another function to find the 'ejection fraction'?

Advice please. Also which forum should this go to?

Thanks
Capp
Reply With Quote
  #2 (permalink)  
Old 01-29-08, 12:09
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,540
Quote:
Originally Posted by cappertan
If I use a '%' wildcard to find 'LEFT VENTRICLE', can I\should I substring? or use another function to find the 'ejection fraction'?
yes, you'll want to use SUBSTRING, but only together with POSITION to position yourself on the right substring

Quote:
Originally Posted by cappertan
Also which forum should this go to?
depends

what database management system are you using?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-29-08, 12:19
cappertan cappertan is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
I am using Teradata DBMS.
So I would not need to use a statement like:Where text like '%LEFT VENTRICLE%'? Just use SUBSTRING and POSITION, right?
Reply With Quote
  #4 (permalink)  
Old 01-29-08, 12:27
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,540
no, you would have to use the LIKE in the WHERE clause, to eliminate all rows you're not interested in

then use SUBSTRING and POSITION in the SELECT clause

note: i dunno if Teradata supports those functions, check your manual


moving thread to "Other" forum as we don't have one for Teradata
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-29-08, 12:42
cappertan cappertan is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
Got it!!!!!!!!!!!!

Thanks a lot R937, you have been a big help.
Capp
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On