Greeting and appreciation in advance

I have a table like this:

Product | Type | Price |
---|---|---|

Product 1 | A | 1000 |

Product 2 | A | 300 |

Product 3 | B | 200 |

Product 1 | B | 500 |

Product 1 | A | 999 |

I need to get the **highest price** for the record matching both **Product** and **Type, and put the results in a new field.**

Like this:

Product | Type | Price | Field4 |
---|---|---|---|

Product 1 | A | 1000 | 1000 |

Product 2 | A | 300 | 300 |

Product 2 | B | 200 | 200 |

Product 1 | B | 500 | 500 |

Product 1 | A | 999 | 1000 |

I assume that I should make **Field4 a calculation** using the **ExecuteSQL** function, however failed after many tries.

Please kindly help me solving this.

Many thanks!

Unstorred calculation for field4, replace tablex with your table name, make sure to escape it as necessary:

ExecuteSQL ( "

select max(Price)

from tablex

where Product = ?

and Type = ?

" ; "" ; "" ; Product; Type)