Oracle:如何在使用select all with multiple join时检索表名

时间:2012-11-09 18:04:17

标签: oracle pdo

我有一个包含大量连接的查询,使我的总列数超过1000.要解决这个限制,我需要使用select *而不是手动定义别名。

我想做

SELECT    *
FROM      table0 t0
INNER JOIN table1 t1
ON         t0.field = t1.field
WHERE      rownum < 10

在我的结果中,我需要在列名

中定义以下内容
t0.column
t0.column2
t1.column
t1.column2

我是否缺少允许这样的概念或技术?我真的不想依赖字段顺序,因为它可能会改变。

3 个答案:

答案 0 :(得分:0)

你可以做点什么:

SELECT t0.column, t0.column2, t1.column, t1.column2, t0.*, t1.* 
FROM      table0 t0
INNER JOIN table1 t1
ON         t0.lm_mst_uid = t1.lm_mst_uid
WHERE      rownum < 10

答案 1 :(得分:0)

SELECT    t0.*, t1.*
FROM      table0 t0
INNER JOIN table1 t1
ON         t0.lm_mst_uid = t1.lm_mst_uid
WHERE      rownum < 10

答案 2 :(得分:0)

也许你可以提一下:

SELECT t1.*, 't1 <-> t2' , t2.*,  't2 <-> t3', t3.*

现在你最终看到了这样的事情:

 t1...................................|           | t2................|           | t3.....................|
 01-02-2012 | ... | More data from t1 | t1 <-> t2 | Some data from t2 | t2 <-> t3 | Now data from t3 | ... |
 01-02-2012 | ... | More data from t1 | t1 <-> t2 | Some data from t2 | t2 <-> t3 | Now data from t3 | ... |
 01-02-2012 | ... | More data from t1 | t1 <-> t2 | Some data from t2 | t2 <-> t3 | Now data from t3 | ... |
 01-02-2012 | ... | More data from t1 | t1 <-> t2 | Some data from t2 | t2 <-> t3 | Now data from t3 | ... |
 01-02-2012 | ... | More data from t1 | t1 <-> t2 | Some data from t2 | t2 <-> t3 | Now data from t3 | ... |
 01-02-2012 | ... | More data from t1 | t1 <-> t2 | Some data from t2 | t2 <-> t3 | Now data from t3 | ... |

而且你知道那些标记't1 <-> t2'之间的所有内容都属于一个表格。