Orderbybtcountdesc or orderbybtcount is invalid. Is there any sort statement?

Source: Internet
Author: User
Tags type null
Orderbybtcountdesc or orderbybtcount is invalid. Is there any sort statement? Select * from table where yz = '1' order by btcount desc write output is incorrect,

The field btcount is very short. generally, it is = 0 or = 1, and the maximum value is = 8.

When the data volume is large, you cannot sort by the value of btcount greater than. why?

Which can be correctly ordered by time: select * from table where yz = '1' order by time desc

That is, according to btcount cannot be correctly sorted, is it because the length of the btcount field is too short?

However, in phpmyadmin, clicking in ascending or descending order is effective. do you want to know if order by is not used in phpmyadmin for ascending or descending order?


User btcount time id
Aaa 0 1359119507 1
Bbb 2 1359119506 2
Ccc 0 1359119502 4
Ddd 1 1359119501 6
Eee 0 1359119467 7
Fff 3 1359119467 9
Ggg 2 1359116785 13
Hhh 0 1359119687 15

How can I write the correct output?


Reply to discussion (solution)

Select * from table where yz = '1' order by btcount desc

Where is the yz field?

Select * from table where yz = '1' order by btcount desc

Where is the yz field?

Because yz is the same, I did not name the following table. it has nothing to do with it.

Let's see how phpmyadmin is written. If you click the button, the corresponding SQL code is displayed.

Let's see how phpmyadmin is written. If you click the button, the corresponding SQL code is displayed.

I saw it. it was too complicated to understand, so I came to consult experts.


Let's see how phpmyadmin is written. If you click the button, the corresponding SQL code is displayed.

I saw it. it was too complicated to understand, so I came to consult experts.
Then paste the SQL code. You don't need to post it. who knows why.

Then paste the SQL code. You don't need to post it. who knows why.

Isn't it written:
Select * from table where yz = '1' order by btcount desc


Then paste the SQL code. You don't need to post it. who knows why.

Isn't it written:
Select * from table where yz = '1' order by btcount desc



It's okay to look at the code.
Try again

select * from `table` where yz='1' order by btcount desc

It's okay to look at the code.
Try again

select * from `table` where yz='1' order by btcount desc


It's useless. I won't ask if it's simple. thank you. please don't reply. wait for the experts!

Check the code. paste the table creation and insert statements.

Explain your statement.
In addition, is btcount int, var, or what format?

Explain your statement.
In addition, is btcount int, var, or what format?

Field type Null default
Btcount int (6) No 0

I don't know what you want to output
You can obtain the following results by posting the so-called query statements and data.

user     btcount         time       idfff        3        1359119467       9bbb        2        1359119506       2ggg        2        1359116785       13ddd        1        1359119501       6aaa        0        1359119507       1ccc        0        1359119502       4eee        0        1359119467       7hhh        0        1359119687       15

I don't know what you want to output
You can obtain the following results by posting the so-called query statements and data.

user     btcount         time       idfff        3        1359119467       9bbb        2        1359119506       2ggg        2        1359116785       13ddd        1        1359119501       6aaa        0        1359119507       1ccc        0        1359119502       4eee        0        1359119467       7hhh        0        1359119687       15


Thanks. I want this output. what is the code?

Select * from table order by btcount desc

You 'd better
Explain select * from table where yz = '1' order by btcount desc
Post this result

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.