Like Concat

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhumadhi
    New Member
    • Jun 2007
    • 4

    Like Concat

    Dear All,

    I have stored Product Name's in the Table "Product Master". The Product names are like ' CS-142',' CS-143',' CS145' etc. If i search the 'CS142' , the record CS-142 should be fetched from the Product_Master table. I need query to get these information.

    Thanks in advance.

    Regards,
    Madhumadhi.S
  • nomad
    Recognized Expert Contributor
    • Mar 2007
    • 664

    #2
    Originally posted by madhumadhi
    Dear All,

    I have stored Product Name's in the Table "Product Master". The Product names are like ' CS-142',' CS-143',' CS145' etc. If i search the 'CS142' , the record CS-142 should be fetched from the Product_Master table. I need query to get these information.

    Thanks in advance.

    Regards,
    Madhumadhi.S
    Sorry we can not do your homework for you. This is a help area.
    Think about what you need to do.
    1. get the fields you want.
    2. what table do you want Product Master
    3. the where what do you want to be found.

    nomad

    Comment

    • madhumadhi
      New Member
      • Jun 2007
      • 4

      #3
      Dear All,

      I have stored Product Names in the Table "Product Master". The Product names are like ' CS-142',' CS-143',' CS145' etc. If i search the 'CS142' , the record CS-142 should be fetched from the Product_Master table.

      The query

      "SELECT * FROM Product_Master WHERE Product_Name LIKE 'CS142%' ";

      The above query is not fetching the records with the Poduct _Name CS-142. if i search with CS142, then i need the record CS-142 to be returned.

      How to modify the above query to carry out this task.

      Thanks in Advance

      Regards,
      Madhumadhi.S

      Comment

      • pradeep kaltari
        Recognized Expert New Member
        • May 2007
        • 102

        #4
        Originally posted by madhumadhi
        Dear All,

        I have stored Product Names in the Table "Product Master". The Product names are like ' CS-142',' CS-143',' CS145' etc. If i search the 'CS142' , the record CS-142 should be fetched from the Product_Master table.

        The query

        "SELECT * FROM Product_Master WHERE Product_Name LIKE 'CS142%' ";

        The above query is not fetching the records with the Poduct _Name CS-142. if i search with CS142, then i need the record CS-142 to be returned.

        How to modify the above query to carry out this task.

        Thanks in Advance

        Regards,
        Madhumadhi.S
        Hi Madhumadhi,
        Try the following:
        [code=mysql]
        WHERE product_name = 'CS%142'
        [/code]

        '%' will match 0 or more characters that can appear between CS and 142. I hope this helps you.

        Regards,
        Pradeep

        Comment

        Working...