comparing like fields in same table [message #6874] |
Fri, 09 May 2003 08:41 |
wnc
Messages: 3 Registered: May 2003
|
Junior Member |
|
|
I have a table that contains names(formal, preferred, former married, etc). The unique key is called addrkey. There are several entries(rows) for each individual, and the individual is identified by the field nameid. Each name entry(row) has a title(Mr., Mrs., Dr., etc) designated by nametitle. Each name entry is also designated by type (a=preferred, f=formal), which is designated by the field nametype.
What I need to do is find individuals who have different titles in their good and preferred names. For instance, if John Smith's formal title is Dr., and his preferred title is Mr., I want to return his nameid. However, in order to do this, I need to compare rows in the table where the nameid is the same, but nametitle is different, and where the two nametypes being compared are equal to 'a' and 'f'. There are other types of names besides formal and preferred, so there can be more than two rows for each nameid. I need to limit it to preferred and formal.
Thanks in advance,
Will
|
|
|
|
|
|