EDIT: Looking for help from J. Leffler, Cheese Con Queso or anyone who knows Informix-SE well.
Informix-SE 4.11:
I have a table called ‘cuadre’ which is used to reconcile the cash drawer at the end of each business day (Monday thru Saturday). Once the drawer has been reconciled, the amount in the cash drawer is stored in column ‘cu_sa_cash’, the row is saved and the system is shutdowned, the store is closed for the day and we all go have some beers.. On the next business day, we start up the system, run an SQL procedure that creates (inserts) a new row in the cuadre table for that days postings and repeat the cycle again.
I would like for my SQL proc to INSERT the new row for the current day with the same cash in drawer amount that was stored in the previous business days row. Keep in mind that this is not SPL, as I’m still using SE 4.11.. So, the below SQL statements are the general idea of what I want to accomplish, but they don’t work!.. Can you provide me with solution?.. Thanks!
INSERT INTO cuadre(cu_date,cu_en_dincaja)
VALUES (TODAY,(SELECT cu_sa_cash
FROM cuadre
WHERE cu_date = (SELECT MAX(cu_date)
FROM cuadre)));
or
INSERT INTO cuadre(cu_date)
VALUES(TODAY);
UPDATE cuadre
SET cu_en_dincaja = (SELECT cu_sa_cash
FROM cuadre
WHERE cu_date = TODAY - 1)
WHERE cu_date = TODAY;
using a temp table was the solution to the problem