#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Help me, simple SQL but how effective


    hi, everyone!
    I have 3 tables: tlog(autoid, namt, acctno), tlogA(autoid, namt, acctno) the different is tlog are transactions current day, and tlogA are transactions in past.
    And a table EMP(empcd, name, salary).
    I want to list each time increase salary transaction of employee with old salary, new salary, how much it increase.
    Know that: NAMT is how-much-salary-increase
    and ACCTNO is EMPCD
    I'm very sorry for my poor english.
  2. #2
  3. Humble Learner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    280
    Rep Power
    120
    since tlogA is an archive table there will be no transaction on that table, right ?

    so all the transactions will be on tlog.

    Just create a trigger on UPDATE event and write all the details into another log table.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0
    Originally Posted by debasisdas
    since tlogA is an archive table there will be no transaction on that table, right ?

    so all the transactions will be on tlog.

    Just create a trigger on UPDATE event and write all the details into another log table.
    today is 06/02/2011
    then tlog are all transactions in 06/02/2011
    and tlogA are all transactions that executed before 06/02/2011 (06/01/2011 or 05/01/2010)

    I want to do this job by SELECT statement
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    859
    Rep Power
    388

    Cool


    Originally Posted by swordsaint
    ... Etc ...
    I want to do this job by SELECT statement
    And what is preventing you from coding the select statement?
    Maybe you need to review your SQL 101 course materials?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0
    I have a solution, but it's not effective. I want to see other solutions. I'm not pro, just newbie so that I find my answer on here.
  10. #6
  11. Humble Learner
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    280
    Rep Power
    120
    Lets see your solution and try to make that effective.

IMN logo majestic logo threadwatch logo seochat tools logo