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请高手教我怎么写能正确输出?

解决方案 »

  1.   

    select * from table where yz='1' order by btcount descyz字段在哪里?
      

  2.   

    那你看看phpmyadmin是怎么写的吧。正常你点了按钮,上面会有相应的sql代码的。
      

  3.   


    看了,那个太复杂了,看不懂,所以才来请教高手的。
    那你把sql代码贴出来啊。你不贴出来谁知道是什么原因。
      

  4.   


    不是写了吗:
    select * from table where yz='1' order by btcount desc
      

  5.   


    不是写了吗:
    select * from table where yz='1' order by btcount desc光看代码没问题啊。
    要不试试select * from `table` where yz='1' order by btcount desc
      

  6.   

    explain 一下你的语句。
    另外btcount是 int, var还是什么格式?
      

  7.   


     字段      类型     Null   默认 
    btcount  int(6)   否      0  
      

  8.   

    不知你想输出什么
    对于你主贴所谓查询语句和数据,能得到一下结果
    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
      

  9.   

    select * from table order by btcount desc
      

  10.   

    你最好把 
    explain select * from table where yz='1' order by btcount desc
    这个结果贴出来