|
|
|
| Hi
First sorry for my terreble english
I have mysql table like this:
id | name
---------------------
1 | Ivan
2 | John
3 | John
Now i wanna display it on web page like this
Ivan (1)
John (2)
Selecting duplicates, buth only showing number of duplicates..
How to do that?
tnx in advance
Dejan
| |
|
| Dejan wrote:
> Hi
>
> First sorry for my terreble english
>
> I have mysql table like this:
>
> id | name
> ---------------------
> 1 | Ivan
> 2 | John
> 3 | John
>
> Now i wanna display it on web page like this
>
> Ivan (1)
> John (2)
>
> Selecting duplicates, buth only showing number of duplicates..
SELECT COUNT (id) GROUP BY name
Arjen
| |
|
| Arjen wrote:
>
> SELECT COUNT (id) GROUP BY name
Ehmm .... SELECT name, COUNT (id) FROM table ORDER BY name
| |
| Jerry Stuckle 2006-04-13, 7:59 am |
| Arjen wrote:
> Arjen wrote:
>
>
>
> Ehmm .... SELECT name, COUNT (id) FROM table ORDER BY name
SELECT name, COUNT(id) FROM table GROUP BY name
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
| |
|
| How cann i display now name and count number in this code?
print "<table cellspacing=0 border=1 width=\"25%\" class=\"redovi\">\n";
print "<tr class=\"headline\"><td> Grad </td></tr>";
while ($qry = mysql_fetch_array($result)) {
print "<tr><td><a href=\"" . "prikaz_jednoga.php?id=$qry[id]\"
>$qry[id]</a></td>";
print "</tr>\n";
}
print "</table>\n";
Jerry Stuckle <jstucklex@attglobal.net> wrote in message
news:P4GdnYD8Gs3boqPZnZ2dnUVZ_tGdnZ2d@co
mcast.com...
> Arjen wrote:
>
>
> SELECT name, COUNT(id) FROM table GROUP BY name
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================
| |
|
| Jerry Stuckle wrote:
> SELECT name, COUNT(id) FROM table GROUP BY name
AAARCH !!
Well u know what I mean :-)
Arjen
| |
|
| Dejan wrote:
> How cann i display now name and count number in this code?
Optianal: SELECT COUNT(id) AS mycounter
while $row=mysql_fetch_assoc($q)
{
echo "$row['name'] ($row['mycounter'])<br>\n";
}
Arjen
|
|
|
|