You are here: Ranking function in PHP/MySQL « PHP Programming Language « IT news, forums, messages
Ranking function in PHP/MySQL

Posted by Colleen on 10/06/07 18:16

Hello!

I've only been dabbling in PHP and MySQL for a few months.

I'm trying to find out if there's a query/function similar to the RANK
function in Excel.

What I want to be able to do is take a list of dates from a particular
table field, and be able to rank each record in the order within which
in falls in those range of dates, because records are not always
entered in chronological order.

Here's a partial sampling of my table, showing the relevant fields for
this query.

casualtyID deathdate
1 2003-12-01
2 2007-06-20
3 2002-08-30
4 2007-01-01
5 2005-04-11

So, from this "ranking" query (that would generate the result $rank),
I want to be able to say:
echo "$casualtyID is the number $rank casualty to die in the current
wars in Iraq and Afghanistan\n";


Thank you!

Colleen Robledo
http://www.colleenrobledo.info

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация