Hello,

How to use date function in my sql for current date.

Table description:

jid desc cname category date(posting date)
1 kpo job ab kpo 7/3/2011
2 lpo job bc lpo 8/3/2011
3 bpo job df bpo 9/3/2011

What i want to do, when i fetch data from the table it must be according to current date.
i.e..
jid desc cname category date(posting date)
3 bpo job df bpo 9/3/2011
2 lpo job bc lpo 8/3/2011
1 kpo job ab kpo 7/3/2011

Please suggest me any idea.
Thanks

select * from table_name order by posting_date desc

Is date a character or a date field? In the latter case you could use a query like

select * from mytable sort by date desc;

In the former case you have to convert the date field with an inline function.

mysql uses the following date format
yyyy-mm-dd

you will have problems until you format your date correctly.

Be a part of the DaniWeb community

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