473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Duplicates

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

Apr 13 '06 #1
6 1196
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
Apr 13 '06 #2
Arjen wrote:

SELECT COUNT (id) GROUP BY name


Ehmm .... SELECT name, COUNT (id) FROM table ORDER BY name
Apr 13 '06 #3
Arjen wrote:
Arjen wrote:

SELECT COUNT (id) GROUP BY name

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.
js*******@attglobal.net
==================
Apr 13 '06 #4
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 <js*******@attglobal.net> wrote in message
news:P4******************************@comcast.com. .. Arjen wrote:
Arjen wrote:

SELECT COUNT (id) GROUP BY name

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.
js*******@attglobal.net
==================

Apr 13 '06 #5
Jerry Stuckle wrote:
SELECT COUNT (id) GROUP BY name

Ehmm .... SELECT name, COUNT (id) FROM table ORDER BY name

SELECT name, COUNT(id) FROM table GROUP BY name


AAARCH !!

Well u know what I mean :-)

Arjen
Apr 13 '06 #6
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

Apr 13 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Michelle | last post by:
hi, i have created an array from recordset containing user names eg. (davidp, davidp, evenf, patricka, rebeccah) which i have sorted in alphabetical order, but i need to identify duplicates...
6
by: Marlene | last post by:
Hi All I have the following scenario, where I have found all the duplicates in a table, based on an order number and a part number (item).I might have something like this: Order PODate Rec...
16
by: tyrfboard | last post by:
I've been searching for awhile now on how to remove duplicates from a table within an Access db and have found plenty of articles on finding or deleting duplicates. All I want to do is remove them...
3
by: AK | last post by:
Hi Our product uses MS-SQL Server 2000. One of our customer has 10 installations with each installation stroring data in its own database. Now the customer wants to consolidate these databases...
7
by: vsgdp | last post by:
I have a container of pointers. It is possible for two pointers to point to the same element. I want to remove duplicates. I am open to which container is best for this. I thought of using...
14
by: ak | last post by:
Is it possible to find repeated(duplicate) element in an array in single loop ? AK
3
by: ryan.paquette | last post by:
In the table there are 2 fields in which I wish to limit (i.e. No Duplicates) Although I do not want to limit them to "No Duplicates" separately. I need them to be limited to "No Duplicates" as...
7
by: john.cole | last post by:
I have searched all the groups I can, and I still haven't been able to come up the solution I need. I have the following problem. In my form named sbfrmSpoolList, I am entering a job, spool and...
1
by: tskmjk55 | last post by:
Recently, I have a requirement to develop a vb.net application wherein the input excel sheet data which has an average of 5000 records should be checked for Internal duplicates (duplicates within the...
3
Thekid
by: Thekid | last post by:
I'm trying to figure out a way to find if there are duplicates in an array. My idea was to take the array as 'a' and make a second array as 'b' and remove the duplicates from 'b' using 'set' and then...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.