var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: pairs of data
How can I display if the query results more than one value?
For example, how can I do a query that produces all pairs of salespeople who are living in the same city.
Thanks in advance.
Honestly, I don't understand the question. Could you provide sample input and desired output to illustrate the problem?
Are you saying that if the following salespeople exist:
then the SQL should show all possible pairs for London? i.e.
If so then this would do it:
If I used != instead of < then you would get 6 results instead of 3, with both "Fred Shiela" and "Shiela Fred" in the results for example.
select sp1.name, sp2.name
from salesperson sp1
join salesperson sp2 on sp2.city = sp1.city
where sp1.name < sp2.name;