API
This commit is contained in:
@@ -33,11 +33,11 @@ async function getHotProducts(ctx) {
|
||||
const limit = parseInt(ctx.query.limit) || 10
|
||||
|
||||
const rows = await query(
|
||||
`SELECT id, name, price, sales, stock,
|
||||
`SELECT goods.id, goods.name, goods.price, goods.sales, goods.stock,
|
||||
COALESCE(s.quantity, 0) as stock_qty
|
||||
FROM goods
|
||||
LEFT JOIN stock s ON goods.id = s.goods_id
|
||||
ORDER BY sales DESC
|
||||
ORDER BY goods.sales DESC
|
||||
LIMIT ?`,
|
||||
[limit]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user