devxlogo

Finding Unique Data

Finding Unique Data

Question:
How would I change the following statement to yieldonly unique values?

    select * FROM WEBDBASE     where ST = ‘#State#’ AND #SPECIALTY# = ‘x’;

Answer:
You can’t get unique values when using SELECT *. However, you can specify the DISTINCT keyword immediately before the column name of the column that you’d like to be unique:

    SELECT DISTINCT st FROM Webdbase    WHERE specialty = ‘x’;

devx-admin

Share the Post: