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

  • SEARCH
  • Home
  • 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 8308975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:58:01+00:00 2026-06-08T18:58:01+00:00

I tried to learn about MySQL Variable and do command like this SET @target=`name`;

  • 0

I tried to learn about MySQL Variable and do command like this

SET @target=`name`;
SELECT @target FROM transaction_product LIMIT 10;

But it is error and said Unknown column 'name' in 'field list'
Why it is error, i’m sure there is column name on my field list

here is the screenshot of the table

MySQL Table

  • 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-08T18:58:03+00:00Added an answer on June 8, 2026 at 6:58 pm

    you need to use different quotes ‘name’ for assigning string to a variable and `name` for column names:

    SET @target='name';
    

    to get column value you can use INTO clause:

    SELECT `name`
    INTO @target
    FROM transaction_product
    LIMIT 1;
    

    to get multiple rows in single variables you can use GROUP_CONCAT:

    SELECT GROUP_CONCAT(`name`)
    INTO @target
    FROM transaction_product
    LIMIT 10;
    

    to execute query dynamically:

    SET @target='`name`';
    
    SET @query1 = CONCAT('
        SELECT ',@target,'
        FROM transaction_product
        LIMIT 10'
        );
    PREPARE stmt FROM @query1; EXECUTE stmt; DEALLOCATE PREPARE stmt;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does \00 mean in Python? To learn more about this, I tried following:
I am trying to learn about the ScriptProperties object in GAS. I tried setting
I tried to create this by following the video at http://www.asp.net/learn/videos/video-7026.aspx where Joe Stagner
I have tried to look for an open source project to learn about language
In my effort to learn more about cross-platform developping in C# I tried checking
I am starting to learn about ajax with jquery and I've tried a lot
I downlaoded an example from the Internet to learn more about the AugmentedReality. And
I've learned programming from Java, then tried to learn one programming language per year,
Sorry for a noob question regarding MySQL. I downloaded FlightStats to learn about mysql
Following my question yesterday , I tried to learn a bit more about 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.