select * from table where yz='1' order by btcount desc这样写输出不对,btcount这个字段很短,一般都是=0或=1,最大不超过=8当数据量大时,就不能按btcount值的大于排列了,不知道为什么?按time又能正确排序的:select * from table where yz='1' order by time desc就是按btcount不能正确排序,难道是因为btcount字段长度太短了?但在phpmyadmin中点击升序、降序又有效的,想知道phpmyadmin中难道不是用order by 来升序、降序的吗?
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请高手教我怎么写能正确输出?
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请高手教我怎么写能正确输出?
看了,那个太复杂了,看不懂,所以才来请教高手的。
那你把sql代码贴出来啊。你不贴出来谁知道是什么原因。
不是写了吗:
select * from table where yz='1' order by btcount desc
不是写了吗:
select * from table where yz='1' order by btcount desc光看代码没问题啊。
要不试试select * from `table` where yz='1' order by btcount desc
另外btcount是 int, var还是什么格式?
字段 类型 Null 默认
btcount int(6) 否 0
对于你主贴所谓查询语句和数据,能得到一下结果
user btcount time id
fff 3 1359119467 9
bbb 2 1359119506 2
ggg 2 1359116785 13
ddd 1 1359119501 6
aaa 0 1359119507 1
ccc 0 1359119502 4
eee 0 1359119467 7
hhh 0 1359119687 15
explain select * from table where yz='1' order by btcount desc
这个结果贴出来