0

To select records from a table who lives in same city which query/command will be used please answer me anyone fast.

21st Oct 2019, 8:27 AM
Disha Dey
Disha Dey - avatar
6 Antworten
+ 4
Check this maybe it can help http://www.sqlservertutorial.net/sql-server-basics/sql-server-find-duplicates/ or try this:- SELECT city_name, person_name, COUNT(city_name) FROM City GROUP BY city_name, person_name HAVING count(city_name) > 1;
21st Oct 2019, 11:04 AM
A͢J
A͢J - avatar
+ 2
You can use GROUP BY query
21st Oct 2019, 8:55 AM
Arsenic
Arsenic - avatar
+ 2
Disha Dey Group By will show alll the records if there is no duplicate value among the column. If you want to get records of same city name then you have to pass the city name in where clause.
21st Oct 2019, 11:58 AM
A͢J
A͢J - avatar
0
Group by showing all city not same city
21st Oct 2019, 9:13 AM
Disha Dey
Disha Dey - avatar
0
But there are 3 same cities
21st Oct 2019, 12:11 PM
Disha Dey
Disha Dey - avatar
0
Disha Dey Do order by city_name so it will show same cities records together.
21st Oct 2019, 12:17 PM
A͢J
A͢J - avatar