關于oracle中的列使用別名后在sql中的操作
在oracle中如果列在sql中操作,是很正常的事,比如:select col1,col2,col1+col2 from table1;
但如果使用了別名,情況就不同了:
select col1 a,col2 b,a+b from table1;
會報以下的錯誤:
ORA-00904: "B": invalid identifier
怎么解決呢,就是套一個select在外面:
select a,b,a+b from (select col1 a,col2 b from table1);
這樣就沒有問題了。
我的微博 http://t.sina.com.cn/1401900445
posted on 2008-03-20 10:47 月掛夜中央 閱讀(1579) 評論(1) 編輯 收藏 所屬分類: SQL很強大