I want to ask something. I don't understand how to get same data from table at only one time. Here are the example

Like table name product_data and there are atleast six field.

in data field the date look like this

product Date
23-04-2012
23-04-2012
23-04-2012
23-04-2012
23-04-2012
23-04-2012
18-04-2012
18-04-2012

But i want the result look like this.

23-04-2012
18-04-2012
I only want to fetch the same date field in only one time. So anyone can tell me the solution.

Thanks,

Recommended Answers

Try this query: SELECT DISTINCT date FROM product_data.

Jump to Post

All 4 Replies

Try this query: SELECT DISTINCT date FROM product_data.

thanks

An alternative is the group by query
SELECT date FROM product_data GROUP BY date

Please mark this post as solved by the way

Member Avatar

DISTINCT will be quicker if the 'date' field is not indexed. However, I would imagine that the speed benefit would be minimal for a simple query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.