我试图使用现有数据库(customerdata)中的DOB列将年龄列添加到数据库(junecustomers)。简单:帮助追加SQL数据
我在两个数据集中都有匹配的名字,姓氏和customerid列。在customerdata数据集中,我有我想用来计算年龄的DOB列。它是否正确?
select * from junecustomers
left join customerdata
on junecustomers.customerid = customerdata.customerid
alter table (junecustomers)
add select
trunc(months_between(sysdate, dob)/12) Age from customerdata
我想要的最终结果是添加了年龄列的原始junecustomers数据集。注意:customerdata数据库对于某些客户有多个条目,但junecustomers数据库只有每个客户一个条目。
你尝试了吗? – WhatsThePoint