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 8256505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:52:46+00:00 2026-06-08T01:52:46+00:00

I got a table of ids from 1 to 1000. How can I select

  • 0

I got a table of ids from 1 to 1000. How can I select to rows from my table and insert the result in to two variables that I declare?

Some thing like this:

Select from table1 where id = 1 or id = 27 into var1, var2
  • 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-08T01:52:47+00:00Added an answer on June 8, 2026 at 1:52 am

    You can do that, but you need to confirm to the following two limitations:

    1. The result set must contain exactly one row
    2. The row must contain exactly two columns

    See this:

    SELECT 'foo', 4 FROM DUAL INTO @a, @b;
    
    SELECT @a, @b;
    +------+------+
    | @a   | @b   |
    +------+------+
    | foo  |    4 |
    +------+------+
    

    And also possible:

    SELECT MIN(id), MAX(Population) FROM world.City INTO @min_id, @max_pop;
    
    SELECT name, population FROM world.Country LIMIT 1 INTO @name, @pop;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the IDs(the rows to be updated) in this query from post table,
I got a table called music with some ids: 6983887641 59088763306 116542622632 106436032725763 6750402929
I got a table with a normal setup of auto inc. ids. Some of
I've got some data in a table that looks like so: Recipe | Category
I've got a simple table that is storing unique IDs tied to a download.
I've got an association table that groups accounts together. I'm trying to select a
I've got a one to many table with ids and traits for those users.
I've got table with two columns: name and grade. It looks sth like this:
I got a table with over 6.6 millions rows. I got a field, named
I've got a TABLE that's actually being used for its intended purpose, to display

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.