[V4RB] tricky [I think] search
Ruslan Zasukhin
sunshine at public.kherson.ua
Wed Sep 29 16:17:31 CDT 2004
On 9/29/04 3:43 AM, "Pedro fp" <lists at pedro.Net.au> wrote:
Hi Pedro,
> 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
Well, this can be made in the single query:
SELECT PersonPtr, max( HistoryDate )
FROM History
WHERE something
GROUP BY PersonPtr
> ...
> "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?
Short form:
WHERE RecID in ( 1, 2, 3, 4, ... )
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list