dimanche 15 mars 2015

SQL Nested Select -Subquery returned more than 1 value-


Vote count:

0




I have one table:


Sales(SalesID, SalesName, SalesCity, SalesState);


I am trying to come up with a query that only shows salesName where there is one SalesName per SalesCity. So for example, if SaleA is in Houston and SaleB is in Houston, SaleA and SaleB will not be returned.



select SalesName, SalesCity, SalesState
from
Sales
where(
select count(*) from Sales group by SalesCity) = 1;


I am not entirely sure how to link the inner select back out. I need another column in the nested select to identify the SalesID. I am currently stuck and have made no progress.



asked 1 min ago







SQL Nested Select -Subquery returned more than 1 value-

Aucun commentaire:

Enregistrer un commentaire