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

The Archive Base Latest Questions

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

got a small little problem I’m hoping someone can help me with. I have

  • 0

got a small little problem I’m hoping someone can help me with.

I have the following dataset in MYSQL:

SELECT * FROM account;

pk  |  customer
1   |   1
2   |   0
3   |   1

I only need the customer column BUT I need it to be in the same order as above e.g.:

customer
1
0
1

However whenever I try and perform the following command, I get the following:

SELECT customer FROM account

customer
0
1
1

I have already tried the following with no luck:

SET @rownum=0;
SELECT @rownum:=@rownum+1 as rank, customer FROM account

rank |  customer
1    |   0
2    |   1
3    |   1

UPDATE: I forgot to add something important. I can’t rely on ordering by the primary key, mainly because the primary key could be a varchar and not integer in some circumstances.

I need the order in which the data was inserted in the database. When I do the same query returning varchar values it is in the correct order.

Any ideas?

Answer: SQL query no order by question

  • 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-02T02:07:06+00:00Added an answer on June 2, 2026 at 2:07 am
    SELECT customer FROM account ORDER BY pk ASC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a small Cocoa problem. I have a StatusBar application that has an
I've got a little stuck with a small problem here: I use serialport communications
I've got a small little page that is going to be viewed from a
I've got a small problem I'm struggling to solve. Let's say I've got an
Silverlight newbie question: I've got a small Silverlight application with the following XAML snippet:
I'd like to realize the following. I've got several small images and if the
I've got a real little interesting (at least to me) problem to solve (and,
I've got a little puzzler here for the bash scripting experts... I have a
I got a little problem with the div width. I show you an image
i got a little problem with searching my database and outputting the data. This

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.