<-- Warning: charset '0' is not supported -->
This should work:
select *
from stuff
group by last_name
You must realize that the row that is displayed for any given name will be
one of many.
For example, if your data set was:
123 Jim Smith
124 Bob Smith
125 Jack Smith
126 Peter Jones
running the above query would give the result:
123 Jim Smith
126 Peter Jones
So, the only Smith that is displayed (in this case) is 123 Jim Smith. The
other 'Smith' rows will not be displayed.
Be careful: since you want to display all columns, but are grouping by only
one column, MySql generally will choose the first row in the grouping to
display.
Hope this helps.
Peter
At 04:18 PM 2/10/2005, you wrote:
>I have a query something like this:
>
>select * from stuff
>
>I want to select rows where each name is distinct like:
>
>select distinct name from stuff
>
>The first query gives me all columns, but includes the duplicate names.
>The second query gives me the name column with no duplicates. How can I
>combine the two, so I get all columns, but without duplicate names?
>
>Thanks
>
>---------------------------------------------------
>PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
>To subscribe, unsubscribe, or to change you mail settings:
>http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss