retrive data from mysql using date as search option

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
anujphp
Forum Commoner
Posts: 25
Joined: Wed Nov 05, 2008 10:12 am

retrive data from mysql using date as search option

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: retrive data from mysql using date as search option

Post 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)?
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: retrive data from mysql using date as search option

Post by pbs »

Try this query


SELECT * FROM `profile` group by category order by date desc
anujphp
Forum Commoner
Posts: 25
Joined: Wed Nov 05, 2008 10:12 am

Re: retrive data from mysql using date as search option

Post by anujphp »

CAtegory have seven values and i need to retrive data from each category which is the most recent one
anujphp
Forum Commoner
Posts: 25
Joined: Wed Nov 05, 2008 10:12 am

Re: retrive data from mysql using date as search option

Post by anujphp »

THANK YOU pbs, your query has solved my problem.THANKS ONCE AGAIN
Post Reply