I have two tables, say t1 and t2.

t1{
txn_id varchar
status varchar
}

t2{
txn_id varchar
date Date
}

I want to built an update query which will update t1.status='X' with join condition t1.txn_id = t2.txn_id and t2.date < sysdate.

Please let me to build an update query.

update t1
set t1.status = 'X' from t2
inner join t1 on t2.txn_id = t1.txn_id 
where t2.date < sysdate.

:)

Use this:

update t1 a
set a.status = 'X' 
where a.txn_id = (select b.txn_id from t2 b 
                  where trunc(b.data) < trunc(sysdate)
                  and b.TXN_ID = a.txn_id)

I have two tables, say t1 and t2.

t1{
txn_id varchar
status varchar
}

t2{
txn_id varchar
date Date
}

I want to built an update query which will update t1.status='X' with join condition t1.txn_id = t2.txn_id and t2.date < sysdate.

Please let me to build an update query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.