小程序云开发数据库查询 如何返回唯一不同的值?
例如订单列表,有 id name price 等字段,我需要查询所有的产品名称也就是name的值,有重复的就返回唯一的值
小程序云开发数据库查询 如何返回唯一不同的值?Mini Program Cloud Development Database Query How to return unique and different values?
小程序云开发数据库查询 如何返回唯一不同的值?小程序云开发数据库查询 如何返回唯一不同的值?
例如订单列表,有 id name price 等字段,我需要查询所有的产品名称也就是name的值,有重复的就返回唯一的值
How to return a unique and different value for the query of small program cloud development database? For example, in the order list, there are fields such as ID, name, price, etc. I need to query all the product names, that is, the value of name. If there are duplicate products, the unique value will be returned
回答:
limit 1不就行了 sample 也行
例如查询订单列表,遇到重复的产品名称只返回一个值
聚合函数 group 就能搞定