Is it possible to use select * with distinct or write easily something that has the same impact?
I need to select all columns from a table with distinct value, but listing all the columns in select clause would be nerve-breaking because the number of columns is over 20!
In Microsoft SQL Server you can write:
select distinct * from MyTable
However, it is considered "best practice" to specify the columns explicitly, partly because it improves the performance of the query, but also to protect yourself from failures that would arise if the database schema were to change in the future
This should work:
SELECT DISTINCT * FROM TABLE_NAME
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With