On Monday 11 November 2002 21:48, Martin Allan Jensen wrote:
> Okey people, i try again....!!
>
> I have a table in a mysql database that holds this:
> +----+--------+------------+--------+------+
>
> | id | maaler | aflaest    | vaerdi | pris |
>
> +----+--------+------------+--------+------+
>
> | 21 |     11 | 2002-01-01 |  15160 | 0.00 |
> | 22 |     11 | 2002-02-01 |  15180 | 0.00 |
> | 23 |     11 | 2002-03-01 |  15200 | 0.00 |
> | 24 |     11 | 2002-04-01 |  15240 | 0.00 |
> | 25 |     11 | 2002-05-01 |  15250 | 0.00 |
> | 27 |     10 | 2002-11-14 |    210 | 0.00 |
> | 30 |     10 | 2002-12-19 |    230 | 0.00 |
>
> +----+--------+------------+--------+------+
>
> Each "maaler" have it's own start registration witch is:
> +----+----------+-------+
>
> | id | nummer   | start |
>
> +----+----------+-------+
>
> | 10 | 56456    |   200 |
> | 11 | 000002   | 15150 |
>
> +----+----------+-------+

I still don't understand what you're doing :-/

> I then made a script that takes "start" for each "maaler" if it have any
> registrations. Then it does this: if its first field then it takes the
> "vaerdi"(THE VALUE) and - it with the "start" (THE STARTREGISTRATION) For
> the next fields it takes the "vaerdi" - the last "vaerdi". My problem is
> that after the script has ran it have lets say 20 yeas 2002 (the
> registration year called "aflaest" in the table) and lets say two 2003.

But why are you keeping all those transient values ...

> I only need ONE value "vaerdi" per year, witch is the one it just calculated

... why don't you just keep the 'latest' value -- which should be the maximum 
value?

> in a loop. But it have all the values and years in the array. How do i only
> take ONE value per year in PHP NOT SQL??
>
> I really hope this is discriping enough....!!

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
A lot of people are afraid of heights.  Not me.  I'm afraid of widths.
                -- Steven Wright
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to