有一个table, 里面有Store 名字, 每笔交易(Transaction),交易时间(Updatetime)的信息。
目的:传入Store的名字作为参数,查询到最近一次的交易日期。
例如,传入“Store1”,返回“8/21/2022" 传入”Store2“,返回”8/5/2022"
请教这个function怎么写? 另外这个表有上千万的数据,所以对搜索时间有一定的要求, 至少不能导致 time out
StoreName | Transaction | UpdateTime |
---|---|---|
Store1 | XX | 8/19/2022 |
Store1 | XX | 8/20/2022 |
Store1 | XX | 8/21/2022 |
Store2 | XX | 7/1/2022 |
Store2 | XX | 7/5/2022 |
Store2 | XX | 7/26/2022 |
Store2 | XX | 8/5/2022 |