Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update record in same table 1

Status
Not open for further replies.

sanctified

Programmer
Mar 9, 2006
65
GB
I have a table which self-joins to itself by the following fields: SiteID and MergeID

So I will have:

SiteID MergeID StartDate Notice MergeStatus
127 128 01/12/2006 7
128 127 02/12/2006 7
My asp application will pass in the siteid for one of the records. I will need to update the MergeStatus field using the following definition: If the duedate (startdate - notice) > today then set the MergeStatus to 1 for the OTHER record i.e the mergeid that matches the sitedid being passed in otherwise set the mergestaus for the siteid being passed in to 2.
Any ideas how to form the SP?

Regards
 
Borislav, I think the Client has confused me!! I am tearing my hair out. But I think the following will work if I tackle it this way.

Basically what they want is to set a flag 1 = earlier date
2 = later date for either of the two records based on the due date (suspension start - notice).

So if record 1 (where siteid=@myid) due date =10/07/2006 - set the mergestatus(flag) to 1
and record 2 (where mergedid=@myid) due date = 11/07/2006 - Set the mergestatus(flag) to 2

So when I come to do any reportings, I'll only want to print the matched records where the mergestatus(flag) = 1

Are you able to provide code for this?
Your help is highly appreciated!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top