On 21/10/2013 05:01, Bob M wrote:
Hi again

b) retrieve the last record
***************************
Assuming you have a column x which imposes the order you're after:

SELECT MAX(x) FROM t

to get the max key

SELECT * FROM t WHERE x=<max key>
**************************
I have a primary key comprising first two columns Date and Hours e.g.
01-01-2009, 6

And so what do I change the above code suggestion to ?

You can always order the results and select one row:
   SELECT * FROM t ORDER BY datecol DESC, hourcol DESC FETCH FIRST ROW ONLY

Sounds like you need to read a good book on SQL and also a tutorial on JDBC.
--
John English

Reply via email to