Ron
You want SELECT DISTINCT ... or SELECT <column list> FROM <table>
GROUP BY <column list>
In either case you probably can't use SELECT * - you have to specify
the columns you're after. This is because these commands will look
for any differences and if they see one they'll give you a new row;
if all you're after is the userID use SELECT DISTINCT userID ...
this will only return a particular value once.
See the documentation for your particular DBMS; GROUP BY is the more
powerful with all kinds of aggregate functions available but sounds
like SELECT DISTINCT will work fine for what your after.
Good Luck,
Frank
On Dec 10, 2005, at 5:02 PM, php-db-digest-help@xxxxxxxxxxxxx wrote:
From: "Ron Piggott (PHP)" <ron.php@xxxxxxxxxxxxxxxxxx>
Date: December 10, 2005 5:04:28 PM PST
To: PHP DB <php-db@xxxxxxxxxxxxx>
Subject: SELECT
Reply-To: ron.php@xxxxxxxxxxxxxxxxxx
I am trying to put together a SELECT syntax. I am querying a response
database and I only want to obtain each user's name once even if they
have given more than 1 response.
$query="SELECT * FROM conversation_table WHERE
conversation_reference =
$conversation_currently_displayed";
$response_created_by = mysql_result($result,$i,"response_created_by");
My ideal is that if users 1, 2, 4 & 5 are in dialogue with each other
the above SELECT $query will only give the results of their identity
once with the mysql_request() function
Thanks for your help.
Ron