Hello, I want to select the Unique values from the tables of the database which are based on the date. Consider, the following table for that:
- name - created
- First - 6/6/09
- Second - 6/9/04
- Third - 9/9/04
- Fourth - 8/8/04
- Fifth - 9/9/09
Hello, I want to select the Unique values from the tables of the database which are based on the date. Consider, the following table for that:
- name - created
- First - 6/6/09
- Second - 6/9/04
- Third - 9/9/04
- Fourth - 8/8/04
- Fifth - 9/9/09
I have tried this before and you can simply make use of the below query and the get the Unique values from the table. So, just make use of that.
This will simply select all form the Techarena table.Code:select * from Techarena;
This will simply select the Unique Category from the Techarena table.Code:select distinct Category from Techarena;
In a table, several columns may include similar records. It is not a trouble; however, occasionally you will want to listing only the different values in a table. The DISTINCT keyword can be used to provide distinct values.
SQL SELECT DISTINCT Syntax
Code:SELECT DISTINCT column_name(s) FROM table_name
Follow the Steps below for solution :
- First you need to start the SQL view window.
- Then you need to Type query as "SELECT DISTINCT" and column name for which you want the values.
eg.Code:SELECT DISTINCT ID- Now you need to type "FROM" and then you must need to give the table name.
Code:FROM Student- Now you can run the query.
It is just required to make use of the Distinct keyword if you want to make get the Unique values from the table. There is not any other solution or query for that. Just use that and get solved for your problem. I have used it most of the time and it works perfectly. You will able to get the Unique values in the Ouutput if you make use of this keyword. You have to provide the column name and table name also.
Bookmarks