based on your requirement
I would like to display only a Jhon with ID and City.
have a rule as to which ID you want to use based on using one of first/last/min/max options for ID - something like
Code:
SELECT first(ID) as fID, Firstname, City
FROM myTable
GROUP BY Firstname, City
but then you said
but i'm interested in showing only one john that is accompanied by an image in case there are two two jhon displaying only one
so for this you use a separate query to get the entire record
Code:
SELECT A.ID, A.Firstname, A.image, A.City
FROM myTable A INNER JOIN (SELECT first(ID) AS FirstID FROM myTable GROUP BY firstname, city) B ON A.ID=B.firstID
I just wanted to know if it is technically possible to do this
yes, very straightforward and the solution principle is a common requirement.