SQL Server2000 語法問題?

圖片參考:http://imgcld.yimg.com/8/n/AD01836210/o/1610101302...

請問 這個語法是哪裡有錯?需要修改哪邊?

上面語法是

SELECT forumMain.main_id, forumMain.main_important, forumMain.main_subject, forumMain.main_content, forumMain.main_name, forumMain.main_email, forumMain.num_hits, Count (forumRe.re_id) AS num_re, Max (IIf(forumRe!re_time Is Not Null,forumRe!re_time,forumMain!main_time)) AS main_update

FROM forumMain LEFT JOIN forumRe ON forumMain.main_id = forumRe.main_id

GROUP BY forumMain.main_id, forumMain.main_important, forumMain.main_subject, forumMain.main_content, forumMain.main_name, forumMain.main_email, forumMain.num_hits

ORDER BY Max (IIf(forumRe!re_time Is Not Null,forumRe!re_time,forumMain!main_time)) DESC;

---------------------------------------------------------------------

錯誤訊息--> 訊息170,層級15,狀態1,行2

行2:'!'附近語法不正確。

---------------------------------------------------------------------

拜託~ 可以幫我解釋一下嗎? 很急!><"

已更新項目:

to愛歹丸

! 也有換成. 這個試過了

所以想說是不是語法的問題?

2 個解答

評分
  • 1 0 年前
    最佳解答

    是否打錯字?

    欄位有這種名字? forumRe!re_time (裡面有驚嘆號)

    2010-10-20 17:20:40 補充:

    是否打錯字?

    欄位有這種名字? forumRe!re_time (裡面有驚嘆號)

    我猜測是打錯字,應該修正為「.」就對了吧?

    ELECT forumMain.main_id, forumMain.main_important, forumMain.main_subject, forumMain.main_content, forumMain.main_name, forumMain.main_email, forumMain.num_hits, Count (forumRe.re_id) AS num_re, Max (IIf(forumRe!re_time Is Not Null,forumRe!re_time,forumMain!main_time)) AS main_update

    FROM forumMain LEFT JOIN forumRe ON forumMain.main_id = forumRe.main_id

    GROUP BY forumMain.main_id, forumMain.main_important, forumMain.main_subject, forumMain.main_content, forumMain.main_name, forumMain.main_email, forumMain.num_hits

    ORDER BY Max (IIf(forumRe!re_time Is Not Null,forumRe!re_time,forumMain!main_time)) DESC;

  • 1 0 年前

    試試看把驚嘆號換成句點

還有問題?馬上發問,尋求解答。