Here is the question to the problem: "FR3.Q7: All views (all columns) that took place after October 15th, by Kindle devices, hosted by Yelp from cities where there are more than 10 clients. Also add the name of the client (as a first column) and city of the client (as a second column) for each view "
I get this far in my code
SELECT c.[Name]
,c.City
,v.ViewID
,v.ViewDate
,(v.ID)
,v.Device
,v.Browser
,v.Host
FROM [View] v JOIN Client c ON v.ID = c.ClientID
WHERE v.ViewDate >= '2019-10-16' AND v.Device LIKE '%kindle' AND v.Host LIKE '%yelp'
GROUP BY c.[Name],c.City,v.ViewID,v.ViewDate,v.ID,v.Device,v.Browser,v.Host
I get a result that is very close to the answer, however I do not have "Cities with at least 10 clients" filter in the result. No matter how I try to get this filter into the code above, it returns a blank table.
This code below successfully pulls up Cities with at least 10 clients in them separately, however I dont know how to get this code into the line of code above. I've tried sub-queries and derived tables but nothing works. Any help would be appreciated
SELECT City
FROM Client
GROUP BY City
HAVING COUNT(ClientID) > 10