create cursor tt (货物名称 c(10), 进货渠道 c(10), 渠道等级 c(1), 进货价 n(10), 建议最高进货价 n(10))
insert into tt values ("照相机", "卡西欧", "A", 16000, 0)
insert into tt values ("照相机", "福士康", "B", 13000, 0)
insert into tt values ("照相机", "莱卡", "A", 18000, 0)
insert into tt values ("高档手机", "华为", "B", 11000, 0)
insert into tt values ("高档手机", "苹果", "B", 12000, 0)
select distinct 渠道等级 from tt into cursor tt1
if "A" $ 渠道等级
UPDATE tt SET 建议最高进货价 = (SELECT MAX(进货价) jhj FROM tt WHERE 渠道等级 == "A") WHERE 渠道等级 == "A"
else
UPDATE tt SET 建议最高进货价 = (SELECT MAX(进货价) jhj FROM tt WHERE 渠道等级 == "B") WHERE 渠道等级 == "B"
ENDIF
SELECT tt
browse
下次要上传DBF表