Bruce,

Try:

SELECT DISTINCT NAME
FROM DOG
WHERE STATUS != 3

Should do the trick.

You obviously don't want the STATUS field. If you include it, you'll get more than one line per name. Similarly for ID. If you want to include the STATUS or ID fields, then you obviously want more than one line (otherwise what would you expect to go in there?).

HTH


Peter

Ysgrifennodd bruce:
hi chris...

your query,
 >>SELECT name FROM dog WHERE status = 3 GROUP BY name<<

will actually give the items where status=3

however, i can't get the resulting issues by doing 'status!=3', because the
tbl has multiple status for a given name, so the query will still return the
other status that aren't equal to '3' for the given name...



-----Original Message-----
From: Chris White [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 04, 2007 9:07 AM
To: [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Subject: Re: group by/select issue..


bruce wrote:
i'm trying to figure out how to create a select query that groups
the tbl around 'name' such that if i want all names that do not
have a status=3, i'd get a single row for 'sue' and 'bob'

I'm not sure why `SELECT name FROM dog WHERE status = 3 GROUP BY name;`
wouldn't give you what you'd want (or that's possibly what you're
looking for?).  If that's the answer then "wee", if not I'll throw my
lost flag in the air.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to