need help with a MySQL query!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lost&found
    Confirmed User
    • Sep 2008
    • 850

    #1

    need help with a MySQL query!

    OK so lets say you have a table with 6 columns and you want to query with a pattern match on 4 columns. How do I do this?

    I can produce accurate result with 1 column like this:

    SELECT * FROM tableName WHERE name LIKE '%pattern%'

    That works with one column like 'name' but if I wanted to query other columns like name,title,comment,ect how would I form this SQL statement?

    details:

    MySQL 5.0.77
    Al cols are Latin_general_ci

    Ya I am a newbie with this stuff.....

    Last edited by lost&found; 05-27-2010, 09:54 PM. Reason: missed info
    need content?

    Email me for exclusive or semi-exclusive!

    sandraxxsyn @gmail.com
  • LoveSandra
    So Fucking Banned
    • Aug 2008
    • 10551

    #2
    bump 4 you

    Comment

    • Spankys Teens
      Confirmed User
      • May 2005
      • 1414

      #3
      [QUOTE=lost&found;17182590]

      SELECT * FROM Name WHERE name LIKE '%pattern%'

      That works with one column like 'name' but if I wanted to query other columns like name,title,comment,ect how would I form this SQL statement?

      Try this:

      SELECT Name, FROM table
      WHERE CONTAINS((COLUMN NAME 1, COLUMN NAME 2), '%pattern%');
      Banners - Design - TGP & more
      Trade: Teenies In Action
      icq: 256664696

      Comment

      • mikke
        Confirmed User
        • Jan 2010
        • 1327

        #4
        ..or

        ..WHERE CONCAT(name,title,comment) LIKE '%name%'
        icq: 395 294 346
        http://www.adultsubmitter.eu - submit any adult site to 20 directories from 1 form!
        now 20 domains!
        http://www.porndeals.eu http://www.ebonybangbros.com

        Comment

        • Spankys Teens
          Confirmed User
          • May 2005
          • 1414

          #5
          Originally posted by mikke
          ..or

          ..WHERE CONCAT(name,title,comment) LIKE '%name%'
          I forgot about CONCAT ....it's been a few years since i used SQL
          Banners - Design - TGP & more
          Trade: Teenies In Action
          icq: 256664696

          Comment

          • fatfoo
            ICQ:649699063
            • Mar 2003
            • 27763

            #6
            Good luck with MySQL.

            I would love to believe that you are the sexy woman in your avatar.

            Look! You can be multiplied by 2!



            What part of Canada are you from?
            Last edited by fatfoo; 06-09-2010, 10:44 AM.
            Send me an email: [email protected]

            Comment

            • lost&found
              Confirmed User
              • Sep 2008
              • 850

              #7
              BC and I am the girl in my avatar!
              need content?

              Email me for exclusive or semi-exclusive!

              sandraxxsyn @gmail.com

              Comment

              Working...