i have three table
table t1;
Sid sValue
1 abc
2 bcd
table t2
Sid Pid Mid
1 a 9
2 a 10
3 b 9
table t3
Mid MValue
9 ZZZZ
10 yyyy
i want to update table ‘t1′ and
set t1.sVal=”” where t2.Pid=’a’ and t3.MValue=’zzzz’
how can i do this pls help me thanks in advance
i have tried it like
update t1 set sVal="" where Sid=(select Sid from t2 where Pid='a' and Mid=(select Mid from t3 where MVale='ZZZZ'))
but it doesnt work and thorw error
like
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name.
The problem is that you are using double quotes instead of single quotes in your set statement.
set sVal=”
not set sVal=””
But if you want a cleaner update statement, this code should do it.