I have a query and I am pulling down the results of Users matched to a country, this is my query so far:
SELECT
UserColder.ContactName,
CountryUser.[User ID],
Country.Name,
Country.ID
FROM
dbo.Country
INNER JOIN dbo.CountryUser
ON Country.ID = CountryUser.[Foreign ID]
INNER JOIN dbo.UserColder
ON CountryUser.[User ID] = UserColder.ID
But what I want to do is make it so it only returns is a country has multiple User IDs to it. So if my data was.
Bob United States
Tom United States
Steve United Stated
Frank Canada
Billy Canada
Lou China
I would want the results to be the
Bob
Tom
Steve
for the United States, and
Frank
Billy
for Canada, but not pull down China because it only has one user tied to it. But pull down the other because US and Canada have creater then 1 user tied to it. Would this be possible in a query?
Thanks!
I’m not sure of the syntax without the database in front of me, but the rank function would be good for this:
Edited thanks to comments 🙂 Also added proof of concept: