Home » SQL & PL/SQL » SQL & PL/SQL » how to find last updated date
how to find last updated date [message #606007] Fri, 17 January 2014 06:18 Go to next message
preethia
Messages: 8
Registered: January 2014
Location: chennai
Junior Member
Hi,

I want to find last modified date and time in a table.

If i'm changing description for a particular id then it will update the date and time change in last updated column. I want to list the columns which has been modified last using oracle sql.
Please help me.
Re: how to find last updated date [message #606009 is a reply to message #606007] Fri, 17 January 2014 06:43 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
use the max function on the column that stores the date that the row was changed.
Re: how to find last updated date [message #606013 is a reply to message #606007] Fri, 17 January 2014 07:12 Go to previous messageGo to next message
preethia
Messages: 8
Registered: January 2014
Location: chennai
Junior Member
pablolee --Max function is listing all the date. it is not working properly.

I want to fetch the last modified/updated date and have to display it in jquery

[Updated on: Tue, 11 March 2014 13:37] by Moderator

Report message to a moderator

Re: how to find last updated date [message #606014 is a reply to message #606013] Fri, 17 January 2014 07:14 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
preethia wrote on Fri, 17 January 2014 13:12
pablolee --Max function is listing all the date.
no it's not. Your query might be listing all the dates, that just means that you've written the wrong query.
Quote:
it is not working properly.
it absolutely IS working properly, the error is yours. Now what that error is is impossible to tell as you have posted no code.
Re: how to find last updated date [message #606017 is a reply to message #606014] Fri, 17 January 2014 07:36 Go to previous messageGo to next message
preethia
Messages: 8
Registered: January 2014
Location: chennai
Junior Member
pablolee -can you please give me a sample query
Re: how to find last updated date [message #606019 is a reply to message #606017] Fri, 17 January 2014 07:43 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
preethia wrote on Fri, 17 January 2014 13:36
pablolee -can you please give me a sample query

A sample query of what? I have no idea what columns you have? You do. You said that you ran a query and got all dates back, post that query.
Re: how to find last updated date [message #606027 is a reply to message #606017] Fri, 17 January 2014 11:28 Go to previous messageGo to next message
preethia
Messages: 8
Registered: January 2014
Location: chennai
Junior Member
I have two tables-- table name= main_table( this is main table)
columns= id,number, desc,createdby,created date, last updated by,last updated date and etc.

table name=history_table( in this table I pick up the last updated date values and storing it in seperate table)
columns= id(foreign key of main_table), desc,lastupdated date

in this, the last updated date is not displaying in history table.

In history table as well as main table, i created lastupdateddate column as sysdate.


I updated description by using id (primary key).

Re: how to find last updated date [message #606028 is a reply to message #606027] Fri, 17 January 2014 11:31 Go to previous messageGo to next message
preethia
Messages: 8
Registered: January 2014
Location: chennai
Junior Member
pablolee-- i just gave select max(lastupdateddate),sowid from sow_tab group by sowid order by sowid;

Re: how to find last updated date [message #606029 is a reply to message #606027] Fri, 17 January 2014 11:32 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
We speak SQL.
Do you speak SQL?
Why do you not post valid CREATE TABLE statements for your tables?

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: how to find last updated date [message #606031 is a reply to message #606028] Fri, 17 January 2014 11:40 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

if sowid is the primary key you have of course all the rows; otherwise you have only the max dates for each sowid as this is what you asked.

Previous Topic: update with aggregate value
Next Topic: / (slash) character after END keyword
Goto Forum:
  


Current Time: Thu Mar 28 16:28:09 CDT 2024