Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须编写一个子查询,该查询将返回由推荐Jorge Perez的同一个人推荐的那些客户的姓名
这是我带来的:
select firstname||' '||lastname "Customer Name",Referred from book_customer where Firstname='Jorge' and lastname=' Perez' order by referred
你所拥有的看起来只会返回 Jorge Perez 和推荐他的人。你需要类似的东西:
select firstname, lastname from book_customer where Referred = (select Referred from book_customer where firstname='Jorge' and lastname='Perez')
在这里,我假设Referred只是用户的 id。上面的查询获取与 Jorge Perez 具有相同推荐 ID 的用户的名字和姓氏。
Referred