Home > database >  The sales ranking problem, this statement is wrong.. Who can help?
The sales ranking problem, this statement is wrong.. Who can help?

Time:11-14

Commodity sales ranking, statistics and schedule of orders for the commodity sales, sales of 0 is not shown,,


Select *, (the select SUM (Amount) from [iOrderDetail] where Ibccode=IbcGoods. Ibccode and PayState=0) as vAmt from Goods where vAmt & gt; Zero order by vAmt desc

CodePudding user response:

Table structure about
IbcGoods this is also a table?

CodePudding user response:

Sales is calculate by the sales amount or sales?
Shall provide the relevant table table structure and fields.

CodePudding user response:

IbcGoods Goods list, namely, I write wrong,,

CodePudding user response:

refer to the second floor started the first response:
sales is calculate by the sales amount or sales?
Shall provide the relevant table table structure and fields.


According to the sales,,, Goods table is ordinary commodity list

CodePudding user response:

Sales is refers to the amount of sales or sales number? It is hard to understand?

CodePudding user response:

It is easy to understand, is the statement has been prompt error,,,

CodePudding user response:

The statement didn't see what's the problem?

CodePudding user response:

 SELECT a. [iOrderDetail], the SUM (B.A mount) AS vAmt 
The FROM Goods AS A
INNER JOIN [iOrderDetail] AS B
ON Anderson bccode=b. [iOrderDetail] AND p. ayState=0
WHERE B.A mount> 0
GROUP BY a. [iOrderDetail]
The ORDER BY vAmt DESC
  • Related