SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    Denver
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Select row starting at certain character

    Hi,
    I am using the below select statement to create a blurb on a homepage to pull readers into in article. The title for the article will always start with the phrase 'Learn more about'. In the blurb I would like the title to be 'Widgets' and in the main article I would like the title to be the full 'Learn more about Widgets'. I tried limiting the title text by using right(title, xx) but I have to change the number value each time. Anybody have a more dynamic solution? Thanks.

    Code:
    SELECT right(title, 16) title, image, left(body, 205) body 
    FROM content ORDER by id DESC limit 1

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    SELECT substring(title,18) title ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    Denver
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!

    Too simple - I should have figured that out.


Bookmarks

Posting Permissions

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