The keyword "DISTINCT" in SQL has the value "unique value". When applied to a column in a query, it returns as many rows from the result set as there are unique, different values โโfor this column. As a result, it creates a grouped result set, and the values โโof other columns are random if they are not defined by other functions (such as max, min, average, etc.).
If you want to say that you want to return all rows for which Col006 has a specific value, use the clause "where Col006 = value".
If you want to say that you want to return all rows for which Col006 is different from all other Col006 values, you still need to indicate that it is value => see above.
If you want to say that the value of Col006 can only be evaluated after all the rows have been extracted, use the "Col006 = value" clause. This has the same effect as the where clause, but where applies when rows are retrieved from raw tables, while presence is applied after all other calculations have been performed (i.e., aggregation functions, etc. ), and just before the result set is returned to the user.
UPDATE:
After viewing your edit, I should indicate that if you use any other sentences, you will get random values โโin all the other nine columns for the row that contains the value โitem1โ in Col006, due to the restriction further in my post.
wolfgangsz
source share