Re: Multiple Entry
| From: | Miles Thompson | Date: | Wed, 01 Aug 2001 17:21:32 +0000 |
| Subject: | Re: Multiple Entry | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10962@lists.php.net to get a copy of this message | ||
Try GROUP BY in the select statement:
select services, machine_name from table
GROUP BY services
order by machine_name;
I believe it should return:
MS Exchange Server and BDC
UAMAIL1
UAMAIL2
UAMAIL3
How well MySQL supports GROUP BY I don't know; I would try this at the console first. The returned result set may make for some tricky processing, or it could be as easy as printing out every row.
Alternately, it's a display question. If results are displayed in tabular format, write the description once, and if it repeats, don't display it in remaining rows until it changes.
Or have I completely misunderstood the question?
Miles Thompson
At 11:30 AM 8/1/01 -0500, Sharif Islam wrote:
I have some data in a table like this: +----------------------------+--------------+| services | machine_name |+----------------------------+--------------+| MS Exchange Server and BDC | MAIL | | Microsoft Exchange for UA | UAMAIL1 | | Microsoft Exchange for UA | UAMAIL2 | | Microsoft Exchange for UA | UAMAIL3 |+----------------------------+--------------+ As you can see, there are same entry for the services column. So If I to display in php : select services from table; then I will get three same entry. Is there any way, I can get only one output.But somehow I have to incorpate it with the other data in that column, which doesn't have multiple entry. Any hint? thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net