"(PeteCresswell)" <x@y.Invalid> wrote in
news:uf3up6tak15idsdqdhsodv1dn0ggt94if7 (AT) 4ax (DOT) com:
Quote:
But is there a more elegant solution? |
Is there a SQL statement that returns a resultset that could be used
to determine if the security is held? I'm thinking of a subquery
evaluated with EXISTS, so that your SQL statement that inserts the
new record each day would only run in the cases that EXISTS ([SQL
statement]) returns TRUE.
I would favor EXISTS here over totalling the positions because it
would not require any summarizing, which is more expensive than just
returning records.
Is there a table that holds records that represent the period the
security is held? If so, you'd filter that table on the dates in
question, and if any records are returned, insert the new record. If
no records are returned, you don't.
Does that make any sense?
--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/