pjohns
12th March 2003, 19:42
I want to update a status field against each record where I have the same reference number.
e.g. I have five records each one has a ref number of AWB1. The first record in this subset has data populated in a status field. I am trying to create a session that will select all records which have the same ref number and makes sure that the status field in each record is the same.
Records:-
1. Ref = AWB1 Status = OK
2. Ref = AWB1 Status = <blank>
3. Ref = AWB1 Status = <blank>
4. Ref = AWB1 Status = <blank>
5. Ref = AWB1 Status = <blank>
So I want my script to select all records in the table and where the ref is the same make sure all status fields are the same.
Below is my verson 1 script. The session runs but nothing gets updated.
function l.status()
{
select tdsls946.*
from tdsls946
selectdo
status = tdsls946.status
awb = tdsls946.awb
select tdsls946.status
from tdsls946 for update
where tdsls946.awb = :awb
selectdo
tdsls946.status = status
endselect
endselect
}
I'm sure there is a simple solution to this, simple to you guys anyway!
Any help you can offer will be appreciated.
Regards
PJ
e.g. I have five records each one has a ref number of AWB1. The first record in this subset has data populated in a status field. I am trying to create a session that will select all records which have the same ref number and makes sure that the status field in each record is the same.
Records:-
1. Ref = AWB1 Status = OK
2. Ref = AWB1 Status = <blank>
3. Ref = AWB1 Status = <blank>
4. Ref = AWB1 Status = <blank>
5. Ref = AWB1 Status = <blank>
So I want my script to select all records in the table and where the ref is the same make sure all status fields are the same.
Below is my verson 1 script. The session runs but nothing gets updated.
function l.status()
{
select tdsls946.*
from tdsls946
selectdo
status = tdsls946.status
awb = tdsls946.awb
select tdsls946.status
from tdsls946 for update
where tdsls946.awb = :awb
selectdo
tdsls946.status = status
endselect
endselect
}
I'm sure there is a simple solution to this, simple to you guys anyway!
Any help you can offer will be appreciated.
Regards
PJ