Hi Folks,
I have a table with orders in it, I'd like to have a constraint so that order lines MUST have a order header record. eg.
ID LINE REF
6 0 MYORDER101
6 1 MYORDER101
6 2 MYORDER101
7 1 MYORDER102
7 2 MYORDER102
7 3 MYORDER102
In this...
Order No. 6 would pass, as line 0 is the order header.
Order No. 7 however should fail as it has no Line 0.
Any tips on how I could do this ?
I have a table with orders in it, I'd like to have a constraint so that order lines MUST have a order header record. eg.
ID LINE REF
6 0 MYORDER101
6 1 MYORDER101
6 2 MYORDER101
7 1 MYORDER102
7 2 MYORDER102
7 3 MYORDER102
In this...
Order No. 6 would pass, as line 0 is the order header.
Order No. 7 however should fail as it has no Line 0.
Any tips on how I could do this ?