简体   繁体   中英

Using SELECT DISTINCT on a few columns - but show all other columns of table

When I use:

SELECT DISTINCT first_name, last_name 
FROM books;

不同的过滤列表

It sorts out all the authors by first and last name in my data set but only shows those two columns.

Is there a way to include all other rows of the data table, not just the two listed in the SELECT DISTINCT ?

Normally SELECT * FROM books; shows everything. 满桌

Is there a command to make it so it filters out the authors that are unique by their first and last name but include all other rows as well?

Thanks!

I think I understand! I am asking the wrong question. The DISTINCT comand lists the unique sets. Which could have more than row for each! So it woudn't make sense to do what I am asking... 在此处输入图像描述

For instance Dave Eggers has three collumns that could be possibly be associated with the filtered DISTINCT row. So which one would it choose ect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM