GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-May-2004, 04:48
eRIC eRIC is offline
Awaiting Email Confirmation
 
Join Date: Nov 2003
Location: Kyrgyzstan
Posts: 31
eRIC is on a distinguished road

MySQL Query Problem


Hi.
I want to list names like in statistics.
In table i have:
name|phone|
-------------
doctor 4522
doctor 8965
eng 523
doctor 320
eng 789
eng 01245
doctor 98662


i wanto to print out like this:

doctors:4
eng:3


AND Does MySQL Support Sub Select ?
  #2  
Old 18-May-2004, 05:49
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Try with this SQL and see if it works:

PHP Code:

<?php
$sql = "SELECT CONCAT_WS( ':', `name` , COUNT(`phone`) ) AS `detail`
FROM `tbl_name`
GROUP BY `name`";
//...
?>

Quote:
Originally Posted by eRIC
AND Does MySQL Support Sub Select ?

Not yet... but apparently soon.
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP MySQL query jgnasser MySQL / PHP Forum 3 08-Apr-2004 06:42
A problem Between MySQL <> phpBB mirable MySQL / PHP Forum 3 10-Sep-2003 06:31
Integrate a mysql query into another norok MySQL / PHP Forum 2 22-Jul-2003 07:25
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 11:34
MySQL Adds Subselects, Upgrades Performance and Security JdS MySQL / PHP Forum 4 22-Jan-2003 18:42

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:39.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.