vaaibhavmohan Posted April 6, 2019 Share Posted April 6, 2019 select A.country,count(A.CustomerID) as N from (select country,Count(CustomerID) as N1 from customers group by country) as A left join (select country,Count(CustomerID) as N2 from customers group by country) as B on A.N1=B.N2 the error:it is not reading A.customerid Link to comment Share on other sites More sharing options...
Ingolme Posted April 6, 2019 Share Posted April 6, 2019 You did not select CustomerID from table A, so you cannot access it. Perhaps you actually want to select N1. Link to comment Share on other sites More sharing options...
Sherin Posted December 5, 2019 Share Posted December 5, 2019 Try updating the code like this : select A.country, count(A.N1) as N from (select country,Count(CustomerID) as N1 from customers group by country) as A left join (select country,Count(CustomerID) as N2 from customers group by country) as B on A.N1=B.N2 group by A.Country Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now