[V4RB] tricky [I think] search

Pedro fp lists at pedro.Net.au
Wed Sep 29 10:43:29 CDT 2004


G'day Folks

My current project has a table "person" which has a one to many  
relationship to a table "history". The history table has a DateTime  
field for maintaining the chronology. It is possible for a person to  
have no related history records at all but all history records must be  
associated with a person [kV_Casade is set on the VObjectPtr].

I need to be able to select all records in person where the most recent  
history record matches a specified value.
The best I can think of is to get a cursor on history, loop through it  
getting all the VObjectPtr values where the match occurs on the most  
recent record and then use those to build a long SQL string of the form  
...
"SELECT ... WHERE RecID = VObjectPtr(1) OR RecID = VObjectPtr(2) OR  
RecID = VObjectPtr(3) ... OR RecID = VObjectPtr(n)"
This seems very unwieldy to me, can anyone suggest a better way?

Cheers, Pedro :-)

Web: <http://www.pedro.net.au>                    PGP Key ID: 387CD96F
Instant messaging...  AIM: bandidoOfOz  ICQ: 27671678  Jabber: pedrofp
                       MSN: mail at pedro.net.au           Yahoo: pedro_fp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
~~~~~~~~~~~~
"Our current commitment to maximum economic growth has become  
counterproductive.
The real needs of people and communities are no longer to obtain more  
stuff. Rather,
more and more people want to enhance their quality of life rather than  
the quantity
of goods they can obtain. People are ready to change the way they  
evaluate success
in their own lives. They are looking for new ways to obtain  
satisfaction."
                                             Robert Theobald in 'The  
Healing Century'



More information about the Valentina mailing list