select *,count(*) from test where num='142';

解决方案 »

  1.   

    select  * from test where num='142';
      

  2.   

    select *,(select count(*) from test where num='142') where num='142';SELECT *: 显示所有记录
     count(*): 聚合函数
      

  3.   

    这个是MYSQL中的一个非标准语句。即在 select ... group by 中,如果没有在 group by 中列出的字段,则MYSQL自行选择一个。 所有当 select *, count(*) 时,相当于group by 中什么都没列出。则所有字段由MYSQL自行选取出一条,一般是选取第一条。
      

  4.   

    语法可以参考手册中的说明。MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
      

  5.   

    你的语句估计是想实现下面这个功能。select *
    from test a,(select count(*) from test where num='142') b
    where num='142';