2. select count(username) from table_name where 1=1
2.select count(username) as u_name from table_name
1.php里,如何判断一个字符串是否被另一个字符串包含?比如判断"abc"是否包含于"what is abc" print substr_count("what is abc", "abc"); // prints out 12.mysql里如何统计一个字表段有多少个数据?比如,username有张三、李四、王五、赵六等等,如果统计一共有几个? select count(*) as total from table_name;
回答问题2 select * from xxx group by username; ================================================================ 不记酬劳,不畏艰难,不辞辛苦,为了我们心中的绿色
支持phpteam(George),用正规表达式判断要方便得多,兼容性更好。 $str="what is abc"; ereg("ab",$str); 如果返回1表示匹配,返回0表示不匹配。 eregi()函数忽略大小写,也就是说Abc和abc是一样的。
1.$str = "what is abc"; if ( strstr($str, "abc") ) echo "has abc"; if ( is_int(strpos($str, "abc")) ) echo "has abc";2.select count(DISTINCT username) from table1 返回所有不相同的 username 的个数
ereg("ab",$str);
print substr_count("what is abc", "abc"); // prints out 12.mysql里如何统计一个字表段有多少个数据?比如,username有张三、李四、王五、赵六等等,如果统计一共有几个?
select count(*) as total from table_name;
select * from xxx group by username;
================================================================
不记酬劳,不畏艰难,不辞辛苦,为了我们心中的绿色
$str="what is abc";
ereg("ab",$str);
如果返回1表示匹配,返回0表示不匹配。
eregi()函数忽略大小写,也就是说Abc和abc是一样的。
if ( strstr($str, "abc") ) echo "has abc";
if ( is_int(strpos($str, "abc")) ) echo "has abc";2.select count(DISTINCT username) from table1
返回所有不相同的 username 的个数