Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ann06
Posting Yak Master
171 Posts |
Posted - 2008-04-23 : 09:42:49
|
| Best Greetings,i want to make an update query for a table but the where clause will check a join with other talbeupdate table1 inner join table 2 on x.table1=y.table2 and y.table1= y.table2set z='anything'or shall it beupdate table1 set z='anything'where x in (select x from table2) and y in (select y from table2)i dont know how the syntax be any idea plz ,also table 2 it will be derived from table1 in the form ofselect x,max(y)from table1order by x |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-23 : 09:46:40
|
| [code]update t1set t1.z='anything'from table1 t1inner join (select x,max(y) as y from table1 group by x) t2 on t1.x=t2.xand t1.y= t2.y[/code] |
 |
|
|
ann06
Posting Yak Master
171 Posts |
Posted - 2008-04-23 : 09:56:47
|
| Thanks proBest Regards |
 |
|
|
|
|
|