2016-04-15 43 views
-4

我的第一次聲明中的偉大工程,但我想訂購的聲明,並取回由[meta_value]SQL錯誤/排序打破PHP

SELECT * FROM wp_postmeta WHERE meta_key = "win_percentage" 
Array 
(
    [0] => stdClass Object 
     (
      [meta_id] => 417 
      [post_id] => 59 
      [meta_key] => win_percentage 
      [meta_value] => 9.3023255814 
     ) 

    [1] => stdClass Object 
     (
      [meta_id] => 419 
      [post_id] => 62 
      [meta_key] => win_percentage 
      [meta_value] => 6.66666666667 
     ) 

) 

SELECT * FROM wp_postmeta WHERE meta_key = "win_percentage" ORDER BY = meta_value ASC 

失敗

+0

WordPress數據庫錯誤:[您的SQL語法錯誤;請檢查與您的MySQL服務器版本對應的手冊,以在第1行'='meta_value「ASC'附近使用正確的語法] SELECT * FROM wp_postmeta WHERE meta_key =」win_percentage「ORDER BY =」meta_value「ASC –

回答

1

ü se ORDER BY {COLUMN_NAME}不使用=與秩序通過。

SELECT * FROM wp_postmeta WHERE meta_key = "win_percentage" ORDER BY meta_value ASC