|
Posted by Jerry Stuckle on 10/06/07 21:29
Colleen wrote:
> 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
>
Next time, please post your SQL questions to a MySQL newsgroup.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|