0
how to use distinct in where clause
when we created a table with some duplicates how to print all the data just like select * from tablename where distinct column_name;
4 Antworten
+ 2
AFAIK DISTINCT is used to filter the results so that only one of the duplicates is included in the resultset. Also I don't see a lot use of DISTINCT when all the columns are selected from the table (your query - SELECT * ...).
* DISTINCT is not used along the WHERE clause.
https://www.w3schools.com/Sql/sql_distinct.asp
0
How can we print all the column s from the table based on DISTINCT column_name
Yeah ! There may be no lot of use bro but it requires in atleast some situations know
0
DISTINCT is used in the Select statement
Select Distinct columname from tablename
this will get you a list of all of the values that appear in that column without duplication
If a column has a certain set of values that are allowed, but you can’t remeber what they are, like the state and territory code of USA, you can use this to get close if running against a well populated DB.
It is also often used to hide a bad join ;)
0
You can use distinct with where
select distinct column_name from Table_Name where Condition ;
select distinct fname from Table_name where e_id > 7 ;
here DISTINCT clause is used to remove duplicates value from column distinct is use with aggregates: COUNT, AVG, MAX, etc.
when you apply specific condition in where at that time you can not use distinct becuse it's display only one record