Hi,
I am a bit confused about the uses of these words. I have a table with he following columns: SITE, LAT, LONG, NAME, ......
I want results with unique (or is it distinct) LAT, LONG. How do I achieve this?
Hi,
I am a bit confused about the uses of these words. I have a table with he following columns: SITE, LAT, LONG, NAME, ......
I want results with unique (or is it distinct) LAT, LONG. How do I achieve this?
UNIQUE is used for defining contraints on the data that can be stored in the table.
DISTINCT is used in queries to remove duplicates from the result set, without affecting the underlying table data.
select unique colA, colB from atable
select distinct colA, colB from atable
In this context, unique and distinct mean the same thing.
Distinct however is ANSI standard, whereas unique is not.
Please note that unique has many other meanings when used in other area's ie index creation etc.
I always like to see a count of how many of each unique item there is so I would:
select lat,long, count(lat) from table group by lat,long but thats just me