Link to home
Start Free TrialLog in
Avatar of Aiysha
AiyshaFlag for United States of America

asked on

matching negative number in access query.

How can I find records with same latitude and longitude values. please see attached image.

Thank you,
Capture.JPG
Avatar of Daniel Pineault
Daniel Pineault

No image was attached to your question.
Avatar of Aiysha

ASKER

Please see now.

I want to find all records that match lat and long
Thank you,
You could make the fields both text, concatenate them in another column, sort on the new column and then add another column that searches for duplicates.  = IF(A2=A1, "Duplicate","").  Probably not the best way, but should work.
Avatar of Aiysha

ASKER

I am doing this in access query
I don't see any matches in the example.
Probably something is missing in the question...the concatenation proposed from Tom should be a viable solution...
If the problem is positive/negative then using ABS to turn everything to positive
Use a query like this to identify the dupes:

Select Latitude, Longitude
From Table_Property
Group By Latitude, Longitude
Having Count(*) > 1

Open in new window

The first thing you need to do is determine the number of duplicate records you have for each Lat/Long combination.  Stealing from Gustav's query:
Select Latitude, Longitude, COUNT(*) AS RecCnt
From Table_Property
Group By Latitude, Longitude

Open in new window

The gives you the number of records for each lat/long combination.
You can sort the count if you want to, or just get the ones with more than one record as Gustav's query does.
Once you get the query you want, you can link it to your table by Lat and Long and select the records with the Count column included.
Modify your query to get whatever you need.
Yes, ...it is not clear what you are defining as a "Match"
because your question title is:
"matching negative number"
...But later you just say:
"I want to find all records that match lat and long", (without any reference to positive or negative)
...We just need to be clear, ...because what happens in the case that there are two matching "Positive" values...? (or some other "Matching" combination)

What in the following would represent a "Match"
Latitude=45.000 Longitude =45.000
Latitude=45.000 Longitude =-45.000
Latitude=-45.000 Longitude =-45.000
Latitude=-45.000 Longitude =45.000

I am leaning with John (Possibly use the ABS() function):
SELECT Latitude, Longitude, IIf(Abs([Latitude])=Abs([Longitude]),"Match","No Match") AS [Match]
FROM Table_Property;

...gets you an output similar to this:
User generated image
JeffCoachman
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.