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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:13:10+00:00 2026-06-14T03:13:10+00:00

I am using mySql and I have a record with is in end of

  • 0

I am using mySql and I have a record with is in end of the table. I want to bring it to the top of the table. How can move it? I mean there are entries at top of the table, how can i replace ids of both the entries with each other.

I want to do this because i want to move the last item to the start of the list, so that it appears first on my website.

thanks

  • 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-14T03:13:11+00:00Added an answer on June 14, 2026 at 3:13 am

    I suppose a simple ORDER BY in the select query will not satisfy your needs, so here is a way to physically replace row with id = 123 with row id = 1 assuming your table has more than 123 rows

    update table_name set id=(select max(id)+1) from table_name where id=123;
    /* this will move the last record to somewhere temporary */
    
    update table_name set id=123 where id=1 ;
    /* this will move the first row to the place of the row that was at the bottom */
    
    update table_name set id=1 where id=(select max(id) from table_name);
    /* moving from temporary row to the first of the table */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using mysql and have a table (Log_Table) storing user login dates, a
Using MySQL, I have a simple table that logs the IP Address that users
using php and mysql I have two tables, a users table and a profiles
I have a front-end Access 2007 database connecting to MySql tables using MySQL ODBC
I'm using MySQL I have three tables: accounts { account_id, username } account_ips {
(Using MySQL and PHP) I have a search form that will allow my users
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
I have been using MySQL for 2 years now, yet I still don't know
I have tried fetching MySQL query results using mysql_fetch_row() and mysql_result() and numeric values
I have created a MySQL database using MySQL Workbench. It has about 20 tables.

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.