I am new to Postgresql Database...i don't know what is problem but below query with Distinct
results non-distinct results. please help on this issue.
SELECT
Distinct(LEAST(name_1, name_2))||GREATEST(name_1, name_2) as keycol,
name_1,
name_2,
latitude,
longitude
FROM england_intersection
order by keycol
limit 100;`
Output result: first field name is kaycol
"007 DriveBroccoli Road";"007 Drive";"Broccoli Road";51.5495845;-0.5349483 "007 DriveBroccoli Road";"Broccoli Road";"007 Drive";51.5495845;-0.5349483 "007 DriveGoldfinger Avenue";"007 Drive";"Goldfinger Avenue";51.5481323;-0.5347869 "007 DriveGoldfinger Avenue";"Goldfinger Avenue";"007 Drive";51.5481323;-0.5347869 "018Stour Valley Way";"018";"Stour Valley Way";50.7637982;-1.8722392 "018Stour Valley Way";"Stour Valley Way";"018";50.7637982;-1.8722392 "018Wimborne Road";"018";"Wimborne Road";50.7622107;-1.8746797 "018Wimborne Road";"Wimborne Road";"018";50.7622107;-1.8746797`
should return one of below
"10095";"100";"95";51.1280481;1.3347689 "10095";"95";"100";51.1280481;1.3347689
should return one of below
"10096";"100";"96";51.1280481;1.3347689 "10096";"96";"100";51.1280481;1.3347689`