取表中数据,某字段名重复的值只取一次,不用数组和临时表,有何方法? select distinct name from tableName 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果要其它字段一起显示select * from tableName group by name 得到总共进过多少种货物select count(distinct name) as cnt from tableName select DISTINCT fieldName from tableName 只取fieldName 的值,同名的只取一次 那如果我要列出name值为aaa和bbb的两样货物的所有记录,用一条select语句可以做到吗? 那如果我要列出name值为aaa和bbb的两样货物的所有记录,这样取不是连重复的也取出来了吗select * from 表名 where name in (select distinct name from 表名 where name='aaa' or name='bbb') 不,是要把重复的也列出来。只要是name为aaa和name为bbb的记录都列出来。 括号里面的select distinct 有用吗?直接select * from 表名 where name ='aaa' or name='bbb'不就好了。这个问题跟开始那个有关吗? select count(namenum) as cnt from tableName group by name order by name 同意 binscut(何时走出迷雾),能用SQL语句来实现的就最好用SQL直接实现。 大家来看看我这个smarty留言版写得对不对 php 正则高手进,正确用正则检测内部链接或外部链接如何实现? 找出mysql中,除自动增长的那个ID外,其他字段完全重复的记录 有关header函数的问题 正则是我永远的痛啊。。。 php读取数据库传递值的问题?小问题,但我不知道错哪里 Linux下配置apache虚拟机 会写聊天工具的请进!(再现等待) 新站开张,大家请提意见 关于日期,有点难!! 能不能在insert完数据后返回auto_increment字段的值?如果insert语句没有这个功能还有比较高效的办法吗? 用PHP做转向的问题(更改下载文件名)
select * from tableName group by name
select count(distinct name) as cnt from tableName
只取fieldName 的值,同名的只取一次
select * from 表名 where name in (select distinct name from 表名 where name='aaa' or name='bbb')
select * from 表名 where name ='aaa' or name='bbb'
不就好了。
这个问题跟开始那个有关吗?