> Only the last one for each
> patient should be used in the
> select statement (each transaction changes the
> patient's balance, but only the last
> transaction has the current balance).  So.....can
> that be done with a select
> statement????

> > SEL t1.TOTLNAME, t2.NEWBALAN, T1.PREVBAL from
> PATINFO
> > t1,  TransAct t2 WHE t1.Patnumber = t2.Patnumber
> and
> > (t2.NewBalan - t1.PrevBal) <> 0

The following modification should eliminate all but
the latest-in-time Transact record, assuming that the
column with the Time of Entry is called EntryTime.

SELECT P.TotLName, T.NewBalan, P.PrevBal +
  FROM PatInfo P, Transact T +
  WHERE P.PatNumber = T.PatNumber AND +
    T.NewBalan <> P.PrevBal AND +
    NOT EXISTS +
      (SELECT * FROM Transact T2 +
      WHERE T2.PatNumber = T.PatNumber AND +
      T2.EntryTime > T.EntryTime)
--
Larry


__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to