Re: [PHP-DB] Re: select distinct with all columns

2002-08-13 Thread russ arbuthnot

Perfect!
Thanks. I'm still trying to get a handle on the GROUP BY command. It's still a 
little bit like magic to me. And in the manual, they don't really show how to 
use it like the way I wanted to use it.
Thanks again,
russ

On Monday 12 August 2002 01:27 pm, Dan Koken wrote:
 SELECT *
 FROM equipement
 WHERE class = microphones
 GROUP BY type;

 Russ Arbuthnot wrote:
  I have a mysql table named equipment with 11 columns named: id,
  staff_member, class, type, manufacturer, model, description, picture,
  created, modified, and published.
 
  I'm trying to write a select statement similar to this:
 
  SELECT DISTINCT type FROM equipement WHERE class = microphones;
 
  yet shows all 11 columns of the selected rows rather than just the
  type column.
 
  The only way I know how to show all the columns is to use SELECT *, or to
  list all the columns manually like SELECT id, type, class, ... etc.
 
  But when I tried doing this:
 
  SELECT DISTINCT type, id, staff_member, class, manufacturer, model,
  description, picture, created, modified, published FROM equipment WHERE
  class = microphones;
 
  I just got the exact same answer as if i would have done this:
 
  SELECT * FROM equipment WHERE class = microphones;
 
  so it didn't help.
 
  Can anyone offer a hint?
  Thanks,
  russ



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




[PHP-DB] select distinct with all columns

2002-08-12 Thread russ arbuthnot

I have a mysql table named equipment with 11 columns named: id, 
staff_member, class, type, manufacturer, model, description, picture, 
created, modified, and published.

I'm trying to write a select statement similar to this:

SELECT DISTINCT type FROM equipement WHERE class = microphones;

yet shows all 11 columns of the selected rows rather than just the
type column.

The only way I know how to show all the columns is to use SELECT *, or to
list all the columns manually like SELECT id, type, class, ... etc.

But when I tried doing this:

SELECT DISTINCT type, id, staff_member, class, manufacturer, model,
description, picture, created, modified, published FROM equipment WHERE
class = microphones;

I just got the exact same answer as if i would have done this:

SELECT * FROM equipment WHERE class = microphones;

so it didn't help.

Can anyone offer a hint?
Thanks,
russ


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