Hi
I am wishing to
(1) locate the newest record in a database (latest date and time)
(2) update the last column (27th) labelled PROFIT_LOSS
I have the following code but it seems to update all records in the database
Can't see what I am doing wrong?
******************************************************
// Update Profit/Loss field
// retrieve newest record from the table
rs = s.executeQuery("SELECT * FROM TABLE ORDER BY Trading_Date DESC,"
+ " Trading_Time DESC FETCH FIRST ROW ONLY");
rs.next();
// and now update the Profit/Loss field.............
// parameter 27 is profit (dec)
psUpdate = conn.prepareStatement("update TABLE SET PROFIT_LOSS=?");
statements.add(psUpdate);
psUpdate.setDouble(1, profit);
psUpdate.executeUpdate();
// commit the above transactions
conn.commit();
// end updating Profit
************************************************************
Thanks for any advice
Bob M
--
View this message in context:
http://apache-database.10148.n7.nabble.com/Updating-the-last-column-in-the-newest-record-tp143710.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.