"igloo" <ig***@spamhole.com> wrote in message
news:ee**************************@posting.google.c om...
Sorry I realise that this is somewhat esoteric I'll try and explain it
better: If I had:
Doc_Type Doc_Number Person_Name GLAID
F 300 00181913
F 300 John 00265898
There are many more fields but by filtering on 00181913 I could never
see the name john I need to put his name in if it has the same
Doc_Type and Doc_Number.
In an ideal world I'd like to populate the Person_Name field with all
'john' but this is not practical at the present.
Hope that's a bit less muddy now?
Thanks again.
IL
That's a little clearer, although I'm still not sure I understand
completely. But I guess you may want something like this:
select f.doc_type, f.doc_number, coalesce(f.person_name, dt.person_name),
f.GLAID
from
foo f
join
(
select distinct doc_type, doc_number, person_name
from foo
where person_name is not null) dt
on f.doc_type = dt.doc_type and
f.doc_number = dt.doc_number
where f.GLAID = '00181913'
Without knowing more about the table structure (ie the CREATE TABLE
statement), and which columns are NULLable, which are keys etc.this is just
a guess, and may not work correctly in all cases.
Simon