1

I have table attendance

    sno         |   OutTime
----------------+--------------
    1           |    2016-01-01
    2           |    

How I get latest sno for passing my update query?
What is the select statement for getting latest sno?

update attendance set outtime=now() where sno=---?
1
  • 1
    Something like select max(sno) from attendance. I am not very good in postgre, check documentation for right sintax. Commented Apr 20, 2016 at 9:26

1 Answer 1

2

Use a sub-query:

update attendance
set outtime = now()
where sno = (select max(sno) from attendance);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.