开发者

Merge and matching tables in Oracle

Does anyone know how to merge two tables with a common column name and data into a single table? The shared column is a date column. This is part of a project at work, no one here quite knows how it works. Any help would be appreciated.

table A 
Sub      Temp      Weight    Silicon   Cast_Date
108     2675       2731      0.7002    18-jun-11 18:45
101     2691       3268      0.6194    18-jun-11 20:30
107     2701       6749     0.6976      18-jun-11 20:30
113     2713       2112      0.6616      18-jun-11 20:30
116     2733       3142      0.7382     19-jun-11 05:46
121     2745       2611     0.6949      19-jun-11 00:19
125     2726       1995      0.644      19-jun-11 00:19


table B
Si      Temperature    Sched_Cast_Date     Treadwell
0.6622  2542    01-APR-11 02:57            114
0.6622  2542    01-APR-11 03:07             116
0.7516  2526    19-jun-11 05:46            116
0.7516  2526    01-APR-11 03:40            107
0.6741  2372    01-APR-11 04:03            107
0.6206  2369    01-APR-11 09:43            114
0.6741  2372    19-jun-11 00:19            125

the results would look like:

Subcar Temp  Weight Silicon Cast_Date          SI     Temperature Sched_Cast_Date Treadwell
116    2733   3142  0.7382   19-jun-11 05:46   0.7516  2526   19-jun-11 05:46    116
125    2726   1995  0.644    19-jun-11 00:19   0.6741  2372   19-jun-11 00:19    125

I would like to run a query that returns a results data only where Sched_Cast_Date and Cast_Date are the same. A table with the same qualities would work just as well.

I hope that this makes more s开发者_JAVA技巧ense.


Are you asking how to join two tables on a common column? i.e.

select a.Sub, a.Temp, a.Weight a.Silicon a.Cast_Date, b.SI,
       b.Temperature, b.Sched_Cast_Date, b.Treadwell
from a
join b on b.sched_cast_date = a.cast_date
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜