Hi,

Someone pls correct the error.

SELECT orderid, merchant, buyprice, commission, refund, (buyprice - refund) as expenseOrder , (commission - expenseOrder )  as profitt
FROM business
WHERE merchant LIKE "GO%"

error:
MySQL said: Documentation
#1054 - Unknown column 'expenseOrder' in 'field list'

Thanks.

Recommended Answers

Replace expenseOrder with buyprice - refund

Jump to Post

All 3 Replies

Replace expenseOrder with buyprice - refund

Thanks. it worked.
one more question:

SELECT orderid, merchant, buyprice, commission, refund, (
buyprice - refund - commission
) AS profitOfEchOrder
FROM business
WHERE merchant LIKE "GO%"

Above code works.
Now how can i SUM profitOfEchOrder?

Put SUM before the parenthesis.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.