First off I want to thanks everybody that help me learn the greatness of
REPLACE INTO I have crafted some very complex statements that ended saving
mass amounts of time programming and much more efficient.

Onto the new problem.

I am attempting to INSERT OR REPLACE rows into an AccountState like so

REPLACE INTO (AccountId, MemberId, SessionId, State)
SELECT (M.Id || '-' || S.Id), M.Id, S.Id, 4
>From Sessions AS S, Members AS M
LEFT JOIN AccountState AS AST ON S.Id = AST.SessionId
WHERE S.OverdueHandled = 0
AND S.Grace < DATE('NOW')
--AND AST.State != 1

Based on the nature of how REPLACE INTO works I created the AccountID field
which is just unique text so a replace can occur.

To save on diskspace I only keep the alert only when the session has been
paid or becomes dilequent so for the other X days there is no need to keep
neutral status in the alert table.
So a record of an account will not be there unless paid or dilequent (which
includes due, grace, overdue, cumalative)  so I need to insert a record if
its not there but I don't want to replace and paid accounts, but i can
overwrite all the other dilquent with a high predecesor

So if I am just being dumb about this please tell me,

Thanks!


-- 
View this message in context: 
http://www.nabble.com/REPLACE-INTO-Help-Once-Again-tf2745497.html#a7660162
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to