![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Wed, Mar 8 2006 6:23 AM | Permanent Link |
"Harry de Boer" | LS
table A (Aid) table B (Bid, Aid, begindate, enddate) table C (Cid, date) If I delete a record from table A the records in table B where B.Aid=A.Aid must also be deleted. No problem. But how do I delete the records in table C where C.date BETWEEN B.begindate AND enddate, but only of course for the record(s) where B.Aid=A.Aid Can this be done in one statement? Regards, Harry dbIsam 3.30, D6 |
Wed, Mar 8 2006 9:41 AM | Permanent Link |
Sean McCall | harry,
Table C has no link to table A or B except by date. Is there a link you forgot to list or is your goal to make sure that there are only records in C where there at least one record in B where B.BeginDate <= C.Date <= B.EndDate? If the latter is the case, I would probably write a procedure to analyze B to find out what part of the date range of the deleted B record no longer covered by another record in B and then delete all the C records within this range. I am sure there is some nasty select / join statement that would do this for you, but sometimes FindKey or SetRange & a little bit of coding is more efficient than SQL. HTH, Sean Harry de Boer wrote: > LS > > table A (Aid) > table B (Bid, Aid, begindate, enddate) > table C (Cid, date) > > If I delete a record from table A the records in table B where B.Aid=A.Aid > must also be deleted. No problem. But how do I delete the records in table C > where C.date BETWEEN B.begindate AND enddate, but only of course for the > record(s) where B.Aid=A.Aid > > Can this be done in one statement? > > Regards, Harry > > dbIsam 3.30, D6 > > |
This web page was last updated on Wednesday, July 2, 2025 at 06:46 PM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |