how can u select the Distinct values in the table, table
having 20 columns , i want all columns
Answers were Sorted based on User's Feedback
Answer / uma
The SELECT DISTINCT Statement
The DISTINCT keyword is used to return only distinct
(different) values.
The SELECT statement returns information from table columns.
But what if we only want to select distinct elements?
With SQL, all we need to do is to add a DISTINCT keyword to
the SELECT statement:
Syntax
SELECT DISTINCT column_name(s)
FROM table_name
Using the DISTINCT keyword To select ALL values from the
column named "Company" we use a SELECT statement like this:
SELECT Company FROM Orders
"Orders" table
Company OrderNumber
Sega 3412
W3Schools 2312
Trio 4678
W3Schools 6798
Result
Company
Sega
W3Schools
Trio
W3Schools
Note that "W3Schools" is listed twice in the result-set.
To select only DIFFERENT values from the column named
"Company" we use a SELECT DISTINCT statement like this:
SELECT DISTINCT Company FROM Orders
Result:
Company
Sega
W3Schools
Trio
Now "W3Schools" is listed only once in the result-set.
| Is This Answer Correct ? | 6 Yes | 3 No |
What is data block and how to define data block size?
what is new philosophy for database devises for sql server 7.0? : Sql server database administration
What are the acid properties?
Does the order of columns in update statements matter?
Explain left outer join and right outer join?
system date format is "yy-mm-dd" "select getdate()" ----> 2009-01-24 20:03:28.513 if i write "select dateadd(dd,2,getdate()) ".it returns "2009-01-26 19:59:38.340"...my question is dat could it be possible to retrive da date in da format "26 jan 2009 ...."??
What are the High-Availability solutions in SQL Server and differentiate them briefly?
Explain how to integrate the ssrs reports in application?
Difference between Cluster and Non-cluster index?
32 Answers Accenture, Agility e-Services, eClinicalWorks, HCL, Infosys, Oracle, Satyam, Yardi,
what is the Surrogate key?and wt is the diff between Primary key and Surrogate Key?
What is indexing explain it with an example?
Explain about remote stored procedure?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)