Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7841681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:09:04+00:00 2026-06-02T16:09:04+00:00

How do you show the string value of a user Defined MYSQL variable in

  • 0

How do you show the string value of a user Defined MYSQL variable in the printed table?

Example:

This…

SELECT CONCAT_WS(  ' ', o.FirstName, o.LastName ) AS FirstLast,
`Company` 
FROM Orders o
    

Gives me this..

|---------------|----------|    
|   FirstLast   | Company  |
|---------------|----------|
| First1 Last1  | Company1 |
| First2 Last2  | Company2 |
| First3 Last3  | Company3 |
| First4 Last4  | Company4 |
|---------------|----------|    

But this…

SELECT @firstlast = CONCAT_WS(  ' ', o.FirstName, o.LastName ),
`Company` 
FROM Orders o

Gives me this…

|-------------------------------------------------------------|----------|
|   @firstlast = CONCAT_WS(  ' ', o.FirstName, o.LastName )   | Company  |
|-------------------------------------------------------------|----------|
|                                                       NULL  | Company1 |
|                                                       NULL  | Company2 |
|                                                       NULL  | Company3 |
|                                                       NULL  | Company4 |
|-------------------------------------------------------------|----------|

Obviously this is incorrect, but I don’t know what is.

How would I ‘print’ or display the value? I’m not even sure if I made the variable correct!

Any direction or pointers would be great.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:09:05+00:00Added an answer on June 2, 2026 at 4:09 pm

    The = operator is for comparison. Since @firstlast is NULL the result of the comparison is NULL.

    The assignment operator is :=.

    @firstlast := CONCAT_WS(' ', o.FirstName, o.LastName) 
    

    Of course, in your specific example there is no advantage in using a variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my code : public void AddToGrid(string value) { MessageBox.Show(value); //Message is showing
When using CDT I would like to have std::string show up in the 'variable'
I'm trying to stop the user from entering the same string value for the
This is my code but i can't fill my string with the value put
MessageBox.Show((some_string.Length).ToString); I am getting two errors for this: The best overloaded method match for
I have a list control where i want to show a string (thats fine)
can anybody show me how to build a string using checkbox. what would be
I need to convert a HashMap<String, Object> to an array; could anyone show me
I have a Windows Form application. What this application does, is let the user
what i have is a textbox into which the user types a string. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.