Re: SELECT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes, DISTINCT will do the same trick, I wasn't sure though as in the context he placed it I reconsidered DISTINCT and thought of GROUP BY because where there may be multiple entries/rows relating to a shared field they would obviously be seperated by perhaps a unique primary key, timestamp, id of some form, you know what i mean? And most likely obviously this field would be a unique field to the table, or at least to that group of rows.. And again, likely it would be time/date controlled, as in a incremental id number, or timestamp etc..


So in that case he may want the latest row??


Again as I've said in previous email, I'm not really sure what he was wanting to do with the query, did he want a particular row? or any row..


Anyway, thats my 5 cents...





---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- ------oOo---------------oOo------ Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 julien@xxxxxxxxxxxxxxxx www.the-spectrum.org ------oOo---------------oOo------ ----- Original Message ----- From: "Philip Hallstrom" <php@xxxxxxxxxxxxxxx>
To: "Ron Piggott (PHP)" <ron.php@xxxxxxxxxxxxxxxxxx>
Cc: "PHP DB" <php-db@xxxxxxxxxxxxx>
Sent: Sunday, December 11, 2005 11:20 AM
Subject: Re:  SELECT


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

SELECT DISTINCT(user_id) FROM conversation_table WHERE conversation_reference = $conversation_currently_displayed

should do it.

-philip

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux