我有一個查詢,我需要用不同的IDDISTINCT未正常工作需要
Query= "SELECT * FROM (" &_
" SELECT DISTINCT t.TICKET_ID as TICKET_ID, "&_
" ROW_NUMBER() OVER (ORDER BY t.TICKET_ID DESC)NUM,"&_
" t.SHORT_DESCRIPTION as SHORT_DESCRIPTION, "&_
" p.TITLE as product_name"&_
" FROM T_TICKET as t,T_USER_PRODUCT as up "&_
" ,T_USER as u, T_PRODUCT as p" & _
pReleaseFrom & _
" WHERE u.USER_ID=t.EDITOR_ID AND not t.SHORT_DESCRIPTION is null" & _
StateCondition & _
") A"& _
" WHERE NUM BETWEEN " & Session("Start") & " AND " & Session("Endi")
Query=Query & " ORDER BY "&orderBy
顯示數據,但一些行並不明顯,它甚至還沒有通過t.TICKET_ID DESC作出該命令。
請幫忙嗎?
這個字符串連接的結果是什麼?這是不工作的SQL的原因?如果不是,它只是分散我們的核心問題。 – 2014-09-03 08:14:17
究竟是什麼字符串?如果你的意思是pReleaseFrom,這是從表中我得到一個組合框取決於用戶選擇 – amira 2014-09-03 08:17:57
不,「查詢」。 – 2014-09-03 08:18:37