We help IT Professionals succeed at work.
Get Started
Private
Troubleshooting Question

Need to see which columns got changed from previous entry.

115 Views
Last Modified: 2020-11-30
Hi Experts,

I have a table with following columns
ScheduleID long
CaregiverID int
PatientID int
VisitDate datetime
ScheduleStartTime datetime
ScheduleEndTime datetime
IsDeleted shorttext
IsMissedVisit shorttext
LastModifiedDate datetime

It has other fields as well, however only these are relevant.

I would like to create a query that will show me for each record what was changed for that ScheduleID from the previous record (sorted by LastModifiedDate column).

I only need the field names, so for example

ScheduleID CaregiverID PatientID VisitDate ScheduleStartTime ScheduleEndTime IsDeleted  IsMissedVisit LastModifiedDate
123,111,222,11/01/20,11/01/20 9:00 AM,11/01/20 5:00 PM,N,N,11/01/20 10:00 PM
123,111,333,11/01/20,11/01/20 9:00 AM,11/01/20 5:00 PM,N,Y,11/01/20 10:30 PM
456,111,222,11/02/20,11/02/20 9:00 AM,11/02/20 5:00 PM,N,N ,11/02/20 10:00 PM

I want to see

123,111,222,11/01/20,11/01/20 9:00 AM,11/01/20 5:00 PM,N,N,11/01/20 10:00 PM,No changes or Blank
123,111,333,11/01/20,11/01/20 9:00 AM,11/01/20 5:00 PM,N,Y,11/01/20 10:30 PM,PatientID IsMissedVisit
456,111,222,11/02/20,11/02/20 9:00 AM,11/02/20 5:00 PM,N,N ,11/02/20 10:00 PM,No changes or Blank.

Thanks





Comment
Watch Question
Sr. System Analyst
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 44 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE