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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:42:28+00:00 2026-05-23T06:42:28+00:00

I want a SQL query to display the following data ID Name 1 AAA

  • 0

I want a SQL query to display the following data

ID Name
1  AAA
2  BBB
3  CCC
4  DDD

as this:

ID Name
4  AAA
3  BBB
2  CCC
1  DDD

without changing the other columns.

Kindly suggest?

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-05-23T06:42:29+00:00Added an answer on May 23, 2026 at 6:42 am

    I’m going with something like this :

    SELECT t2.ID, t1.NAME
    FROM
        (SELECT ROW_NUMBER() OVER(ORDER BY ID DESC) AS rownumber,
               Name
        FROM MyTable) as t1
        INNER JOIN
            (SELECT ROW_NUMBER() OVER(ORDER BY ID ASC) AS rownumber,
                    ID
             FROM MyTable) as t2
    ON t1.rownumber = t2.rownumber
    

    You have to set to each row a number for the Name field, and for the ID field, in different order, and then join between them to retrieve the datas in different order.

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

Sidebar

Related Questions

I want to port this SQL query, which works just fine on SQL Server,
I want to write a SQL query like the following. Its syntax is not
I want to use this SQL query to get only the records between 8
I want to convert the following SQL Query to a SubSonic Query. SELECT [dbo].[tbl_Agency].[ParentCompanyID]
Following is a Paging enabled Query for SQL server, it is working well without
I want to write a SQL query that inserts incremental numbers that start in
I want to make a SQL query that gives the total order value for
I want to make a SQL query that shows me the article that generated
I want to execute a SQL query in a method which permit to erase
I want to write an SQL query using the LIKE keyword. It should search

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.