Jump to content

SQL Experts Please Help


nene_nani

Recommended Posts

  DoctorName

Address

Phno

mobileno

ModifiedDate

John

123MainStreet

7477474747

334348484

01/01/2017

John

123MainStreet

8477474748

444433333

01/03/2017

John

404LinconnHwy

8477474748

666666666

01/05/2017

John

999GregorySquare

8477474748

666666666

01/07/2017

Table: Doctor_History

 

I have a Doctor History table, each time doctor update his information it inserts a record in History table

My requirement is:  I need to create a report “what are the columns changed and Value before and after for that column“

Please see the Final Output report below:

 

 

DoctorName

Modified date

Column  Changed

Field before Value

Field After Value

John

01/03/2017

Phno

7477474747

8477474748

john

01/03/2017

mobileno

334348484

444433333

john

01/05/2017

Address

123MainStreet

 404LinconnHwy

john

01/05/2017

mobileno

444433333

666666666

John

01/07/2017

Address

404LinconnHwy

999GregorySquare

 

    Please help me.                                                           

Link to comment
Share on other sites

select dh.* from doctor d, doctor_history dh
where d.name=dh.name

idi motham records istadi.. tarvata nuvvu sort out chesuko ememi kaavalo.. order by use chesuko, date desc or asc ...

Link to comment
Share on other sites

4 hours ago, nene_nani said:

  DoctorName

 

Address

 

Phno

 

mobileno

 

ModifiedDate

 

John

 

123MainStreet

 

7477474747

 

334348484

 

01/01/2017

 

John

 

123MainStreet

 

8477474748

 

444433333

 

01/03/2017

 

John

 

404LinconnHwy

 

8477474748

 

666666666

 

01/05/2017

 

John

 

999GregorySquare

 

8477474748

 

666666666

 

01/07/2017

 

Table: Doctor_History

 

 

 

I have a Doctor History table, each time doctor update his information it inserts a record in History table

 

My requirement is:  I need to create a report “what are the columns changed and Value before and after for that column“

 

Please see the Final Output report below:

 

 

 

 

DoctorName

 

Modified date

 

Column  Changed

 

Field before Value

 

Field After Value

 

John

 

01/03/2017

 

Phno

 

7477474747

 

8477474748

 

john

 

01/03/2017

 

mobileno

 

334348484

 

444433333

 

john

 

01/05/2017

 

Address

 

123MainStreet

 

 404LinconnHwy

 

john

 

01/05/2017

 

mobileno

 

444433333

 

666666666

 

John

 

01/07/2017

 

Address

 

404LinconnHwy

 

999GregorySquare

 

 

 

    Please help me.                                                           

 

endih baa mee company , DB logs meedha rapisthada? archive logs chusin code chesthara?

inko table to update delete archivng chesthunnara?

read about archiving and archiving tables

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...