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’;

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist