Page 1 of 1

retrive data from mysql using date as search option

Posted: Mon Dec 08, 2008 2:45 am
by anujphp
Hello
I have a table with 4 fields like
table name=profile
name,address,category,date

the category column have 7 different value and i am required to fetch the most recent entry in each category


THANK YOU IN ADVANCE

Re: retrive data from mysql using date as search option

Posted: Mon Dec 08, 2008 2:54 am
by requinix
Are you saying there are up to seven rows in the table all with the same "category"? Or that the "category" has seven values in it (perhaps separated by commas)?

Re: retrive data from mysql using date as search option

Posted: Mon Dec 08, 2008 4:46 am
by pbs
Try this query


SELECT * FROM `profile` group by category order by date desc

Re: retrive data from mysql using date as search option

Posted: Wed Dec 10, 2008 2:05 am
by anujphp
CAtegory have seven values and i need to retrive data from each category which is the most recent one

Re: retrive data from mysql using date as search option

Posted: Wed Dec 10, 2008 2:12 am
by anujphp
THANK YOU pbs, your query has solved my problem.THANKS ONCE AGAIN