Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    3

    Question Unanswered: 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

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Mar 2004
    Posts
    3
    Got it!!!!!!!!!!!!

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •