I have 2 tables:
WorkSchedulewhich has 2 columnsWorkScheduleIDandWorkScheduleStatusWorkShiftBidwhich has 3 columns:WorkShiftBidID,WSBidStatus,WorkScheduleID(foreign key toWorkScheduletable)
I want to update the WorkSchedule table from the WorkShiftBid table. So this is roughly how it goes:
I press a button in my website, it reads the current WorkShiftBidID and updates the WSBidStatus to 'Approved'.
However, I want to update WorkScheduleStatus and WSBidStatus in both tables to 'Approved' where WorkScheduleID in both tables is the same.
I came up with this query but it is not working:
com.CommandText = "update WorkShiftBid b, WorkSchedule w" +
"set b.WSBidStatus ='Approved' and w.WorkScheduleStatus = 'Approved'" +
"where WorkShiftBidID = @id and w.WorkScheduleID = b.WorkScheduleID";
com.Parameters.AddWithValue("@id", id);
How should I change it to work?