最近有一流程程式在客戶那邊的UI畫面順序混亂,百思不得其解。開發環境是oracle9i,客戶是oracle10g.經過辛苦尋找,反覆模擬...找到是原因是distinct,order by先後順序有影響,修正程式先distinct後order by就可以了。現總結分享給大家。
在oracle9i下,先order by後distinct跟先distinct後order by的排序是一樣的。而在oracle10g,這兩種情況不一樣。若要數據排序,必須在distinct後order by.
最近有一流程程式在客戶那邊的UI畫面順序混亂,百思不得其解。開發環境是oracle9i,客戶是oracle10g.經過辛苦尋找,反覆模擬...找到是原因是distinct,order by先後順序有影響,修正程式先distinct後order by就可以了。現總結分享給大家。
在oracle9i下,先order by後distinct跟先distinct後order by的排序是一樣的。而在oracle10g,這兩種情況不一樣。若要數據排序,必須在distinct後order by.