日期:2014-05-17 浏览次数:20785 次
--一共查出了13条数据 select * from user_tab_columns where rownum < 22 and table_name like '%MS_PERMISSION%' --下面的sql本来可以查出我想要的,可是一共只查出了5条数据,怎么少了8条 select u.*,t.POSITION as PK from USER_COL_COMMENTS u left join user_cons_columns t on u.column_name = t.column_name where u.table_name like '%MS_PERMISSION%' and u.column_name like '%%' and u.table_name = t.table_name order by u.table_name,t.POSITION
SELECT U.*, T.POSITION AS PK FROM USER_COL_COMMENTS U RIGHT JOIN USER_CONS_COLUMNS T ON U.COLUMN_NAME = T.COLUMN_NAME AND U.TABLE_NAME = T.TABLE_NAME AND U.TABLE_NAME LIKE '%MS_PERMISSION%' AND U.COLUMN_NAME LIKE '%%' ORDER BY U.TABLE_NAME, T.POSITION;
------解决方案--------------------
你的条件全是注释表的条件,自然全被过滤掉了,把条件全改成主表user_tab_cols的条件