0

Table Name: Order

Columns: ID & NAME & DATE

With the following records :

1 | starone | 2016
1 | starone | 2016
2 | mogaone | 2017
9 | starone | 2016

And am looking to only select data without getting duplicates :

Expected OUTPUT

1 | starone | 2016
2 | mogaone | 2017
9 | starone | 2016

So which query shall i use?

Strawberry
  • 33,750
  • 13
  • 40
  • 57

1 Answers1

0

Let's see what the documentation shows for us:

The SELECT DISTINCT statement is used to return only distinct (different) values.

Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.

SELECT DISTINCT column1, column2, ...
FROM table_name;

SOURCE: https://www.w3schools.com/sql/sql_distinct.asp

So, try it:

SELECT DISTINCT ID, NAME, DATE
FROM Order;
BSants
  • 91
  • 1
  • 11