On 20/08/2010 2:45 a, George Larson wrote:
> I hope I've come to right place, and I'm asking in the right way -- please
> accept my apologies if not.
>
> We have some dates missing and I need to populate those fields with dates
> from the record just before them. I've gotten this far:
>
> SELECT UUid, MIN(DDenteredDate) minDate FROM UUtable JOIN DDdetail on DDid =
> UUid
> WHERE
> UUdate IS NULL
> GROUP BY UUid;
>
> I can make this a sub-query and get the UUid of the record that I want to
> copy UUdate from:
>
> SELECT sub.UUid-1 as previous, sub.* FROM (
> SELECT UUid, MIN(DDenteredDate) minDate FROM UUtable JOIN DDdetail on DDid =
> UUid
> WHERE
> UUdate IS NULL
> GROUP BY UUid;
> ) as sub;
>
> In this case, the field 'previous' is the UUid that I want to copy the
> UUdate from and sub.UUid is where I want to copy to.
>
> Does that even make sense?
>
> Thanks,
> George
>
Can you send the table create statement so that we can see the
structure? I'm guessing the date field is called uudate? (also specify
the field that you want to populate with the record before) Is the
primary key field uuid? are all the numbers in the primary key field
sequential (1,2,3,4) with no gaps? I do have an idea but i need this
info to see if it can work.
--
Jangita | +256 76 91 8383 | Y! & MSN: jangita@stripped
Skype: jangita | GTalk: jangita.nyagudi@stripped