0

I just started taking a database class and we're learning SQL.

I have a table that has several columns. The last two columns are the first name and the last name of a person. No two people have the same last name, and I want to sort the table by the person's name (first and last) and show something like :

Trainee FirstName || Trainee LastName || Trainer FirstName || Trainer LastName || 
AAA               || BB               || Tom               || Banks            ||
Test              || Test             ||                   ||                  ||
CCC               || DD               ||                   ||                  ||
Another           || PERSON           || Susan             || Lee              ||

... etc.

I can get it so the duplicate last names don't show up by doing : break on lastname; select .... order by T.lastname, but I can't figure out how to get the first names to not duplicate as well. Help would really be appreciated, I've looked around online and I've been able to do a lot of the other exercises, but I can't figure out how to do this one.

4

1 回答 1

0

您是否应该通过限制输出或首先防止重复项进入数据库来解决此问题?

如果您试图限制输出,请查看DISTINCT.SELECT

于 2012-10-11T20:30:58.710 回答