0 Replies Latest reply on Mar 26, 2007 2:12 PM by balteo

    Beginner needs help with sql/ejb-ql

    balteo

      Hello,

      I have the following question about sql and ejb-ql:

      key pk action
      1 1 I
      1 2 U
      1 3 U *
      4 4 I *
      5 5 I *
      6 6 I
      6 7 D


      My boss forces me to use a flat table as above. Here is what happened to this table:

      1. A user inserted a record (key and pk == 1)
      2. They then updated the same record. You will notice that the "key" is the same (pk == 2)
      3. They then updated the update. Key is the same and pk ==3
      4. They then inserted a fresh record (pk ==4)
      5. Fresh insert again
      6. Fresh insert again
      7. Delete of immediately previous fresh insert

      You will notice that for each action I have an insert into the db (this is for logging/history purposes).

      I need to be able to retrieve all record that would have survived the updates and deletes through sql i.e. those marked by a star.


      What would be the sql and the ejb-ql for that?

      Any clue welcome,

      Thanks in advance,

      Julien Martin.