SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Oct 2002
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CONCAT a string with a select

    This doesn't work.. what is the alternative?
    Code:
    ...
    SET  price = "select price from table"; //return 5
    SET fprice = "select concat('$', price); //just setting in "$"
    ...
    how would i achive the desired result?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    not sure... what's your desired result?

    and what's up with the SET statements? i think you're using them wrong

    if you want to append the dollar sign in front of the price, this is cosmetic, and should really be handled in the front end application, not in the SQL
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2002
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    only reason why i have it in there like that is cause I need that row to be act like a string, where i can use REGEX.

    It's complicated, So please excuse my weird choice.


    The problem is that no matter how i select a concated char and then SET it into a variable, and then insert it back into the table it just inserts only the "$".


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
  •