Re: selecting values from column without repeating

From: Date: Fri, 19 Jan 2001 03:21:56 +0000
Subject: Re: selecting values from column without repeating
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5967@lists.php.net to get a copy of this message
I've done this before; some databases allow for a UNIQUE specifier in the query (see your documentation). Alternatively (and more resource & time consuming), you can store results in a regular PHP array (not a result resource, etc.) and use array_unique (see php.net/array_unique) to create an array of only unique values. Hope this helps! --Toby ----- Original Message ----- From: "sarahana" <sarahana@cyberjunkie.com> To: <php-db@lists.php.net> Sent: Thursday, January 18, 2001 10:41 PM Subject: [PHP-DB] selecting values from column without repeating Hello, I was wondering if it would be possible to select values from a column (lets say the column "year") so that each value gets retrieved only once... for example, there are multiple rows in a table - some with '2001' as the value for the year column, and some with '2000'. Now, what I wanted to do is list the values of the year so that 2001 shows up only once, and 2000 shows up only once without repeating... is this possible? thanks.

« previous php.db (#5967) next »