Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. MySQL
  4. Return modified value

Return modified value

Scheduled Pinned Locked Moved MySQL
phpmysqldesignhostingquestion
3 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marc Firth
    wrote on last edited by
    #1

    Hi All, I need to return a value with a string appended on the front of it, but I don't want to modify the table. is this possible with mysql? Eg:

    SELECT type FROM table

    Currently returns: "basket" and "cart" But I'd like it to return: "Shopping basket" and "Shopping Cart" (appends "Shopping " before the returned each of the returned values). I thought I could use the CONCAT function but that doesn't seem to work. Any ideas?

    Portfolio | Web Design, Web Hosting & IT Support

    L 1 Reply Last reply
    0
    • M Marc Firth

      Hi All, I need to return a value with a string appended on the front of it, but I don't want to modify the table. is this possible with mysql? Eg:

      SELECT type FROM table

      Currently returns: "basket" and "cart" But I'd like it to return: "Shopping basket" and "Shopping Cart" (appends "Shopping " before the returned each of the returned values). I thought I could use the CONCAT function but that doesn't seem to work. Any ideas?

      Portfolio | Web Design, Web Hosting & IT Support

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi Marc, this should do it:

      SELECT CONCAT('Shopping ',type) AS type FROM table

      :)

      Luc Pattyn


      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


      M 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi Marc, this should do it:

        SELECT CONCAT('Shopping ',type) AS type FROM table

        :)

        Luc Pattyn


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        M Offline
        M Offline
        Marc Firth
        wrote on last edited by
        #3

        Yup. Fantastic Thanks.

        Portfolio | Web Design, Web Hosting & IT Support

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups