雖然上生成排名遊戲的工作方式,我寫了類似下面的代碼查詢(很多列的冷落爲了簡潔),並注意到該排名被生產看似亂碼(第一個查詢)。但是,更改引用遊戲編號的表格會生成正確的結果(第二個查詢)。 mysql> select @i:[email protected]+1 as rank, a.usernum, s.buildings from account_data as a, statistics as
考慮一個表具有以下模式: id, location, starred
有許多記錄與同一位置: id | location | starred
-----------------------
1 rome yes
2 rome no
3 rome no
4 milan yes
5 milan no
6 bozen no
我想有每個位置最多的一個記錄。並且
我安裝了MySQL 4.1服務器版本。我想在'SELECT語句'中使用'show query'作爲子查詢。 例如: SELECT count(*) from (SHOW VARIABLES LIKE 'log_bin');
但是,這給了我一個錯誤,如: ERROR 1064 (42000): You have an error in your SQL syntax; check the man