Home > Software design >  SQL: select all the columns with only distinct rows
SQL: select all the columns with only distinct rows

Time:06-24

I have a DB table of 30 columns with thousands of rows. I want to select all the columns with only distinct rows, so can I do this?

SELECT *
FROM (
    SELECT DISTINCT column13 FROM NameOfTheTable
);

CodePudding user response:

select case when count(*)=count(distinct coalesce(AccntNum, '996658') then 'all distinct' else 'duplicate exist' end from tableName

this, did not work stating syntax error above.

CodePudding user response:

"All the columns with only distinct rows" means this:

select distinct * from table_name

If this is not the correct solution you need to ask the correct question.

  • Related