Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list records with unique values

Status
Not open for further replies.

spiveygb

Programmer
Jun 24, 2003
27
0
0
US
I have a fairly length sql statement where the results may list duplicate values from a field ("servicename" in this case). Is there a way I can modify the sql below to only list unique records from the servicename field? Thanks.

Code:
SELECT     Locale.Place, ServiceNames.FIPS, ServiceNames.ServiceName, ServiceNames.ConnectionStaff, LayerInfo.MaxScale, LayerInfo.MinScale, 
                      LayerInfo.YMAX, LayerInfo.XMAX, LayerInfo.YMIN, LayerInfo.XMIN, LayerInfo.LayerDesc, LayerInfo.LayerName, LayerInfo.LayerTitle, 
                      LayerInfo.GetFeatureRequest, LayerInfo.GetCapRequest, LayerInfo.GetMapRequest, LayerInfo.LegendURL, LayerInfo.MetadataURL
FROM         ((ServiceNames INNER JOIN
                      Locale ON ServiceNames.FIPS = Locale.FIPS) INNER JOIN
                      LayerInfo ON Locale.FIPS = LayerInfo.FIPS AND ServiceNames.ServiceName = LayerInfo.ServiceName)
WHERE     (ServiceNames.ServiceStatus = 'Pending')
ORDER BY ServiceNames.ServiceName
 
Yes. Use aggregate functions to select which of the possible values of the other fields you want to see for each unique value of ServiceName then GROUP BY ServiceName.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top