使用SELECT內COUNT我有這樣的看法:如何在MYSQL
MyView的:(ID,百分比)
我要讓另一種觀點,至極將是這樣的:
LASTVIEW: (lastID,lastPR,計數器)
和「evrey line」中的「counter」我想知道money id的百分比大於這一行的百分比。所以我嘗試過:
CREATE VIEW LASTVIEW(lastID, lastPR, counter) AS
SELECT id AS lastID, percent AS lastPR
COUNT (SELECT id FROM myVIEW WHERE percent < lastPR) AS counter,
FROM myVIEW;
使用您的其他查詢在你的'FROM'子查詢。閱讀[this](https://dev.mysql.com/doc/refman/5.0/en/from-clause-subqueries.html) – adarsh