SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Like #?

  1. #1
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Toronto, Ontario
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Like #?

    Hey guys,

    I was wondering if there was anything that can substitute all numeric characters?

    Code:
    SELECT * FROM Companies WHERE Sector LIKE '%Mining%' AND Company_Name LIKE '$display%' OR  Sector LIKE '%Exploration%' AND Company_Name LIKE '$display%' ORDER BY Company_Name
    Where $display shows up I may have the person select #'s which would shorten the search to companies beginning with a number.

    1company

    8company

    12company

    So I was wondering instead of doing a bunch of OR statements against 0-9 is there a way to check against all of the digits in one shot?

    Thanks,
    Mario
    $ Available For Hire
    Need a website designed or coded? Then feel free to contact me!

    PSP Backgrounds - PSPBG.net || Photoshop Brushes - PSBrushes.net

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    yes, with a regular expression
    Code:
    SELECT columns
      FROM Companies 
     WHERE (
           Sector LIKE '%Mining%' 
        OR Sector LIKE '%Exploration%' 
           )
       AND Company_Name REGEXP '^[[:digit:]]+'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Addict
    Join Date
    Jul 2003
    Location
    Toronto, Ontario
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    r937 saves the day again. Thanks for all the help. I think I may have to buy your book so I can provide some more answers then questions here :-P
    $ Available For Hire
    Need a website designed or coded? Then feel free to contact me!

    PSP Backgrounds - PSPBG.net || Photoshop Brushes - PSBrushes.net


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
  •