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 |
|
markricard
Starting Member
2 Posts |
Posted - 2007-03-27 : 11:15:34
|
| I would like to do something like:UPDATE LevelInstance SET dueDate = MIN(dueDate) WHERE (path LIKE "A/C/D/%" AND depth = 4) OR (path LIKE "A/C/%" AND depth = 3) OR (path LIKE "A/%" and depth = 2)Where I can assign a DIFFERENT MIN value to the rows returned based on each of the WHERE clauses. So, where path is like "A/C/D/%" and depth = 4, those specific rows would have their dueDate set to the min due date of those specific returned rows. Same for the other two ORs.Is this possible to do in a single update sql statement? |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-03-27 : 11:23:35
|
Something like this?UPDATE t1 SET dueDate = (select min(DueDate) from LevelInstance t2 where t2.id = t1.id and ((path LIKE "A/C/D/%" AND depth = 4) OR (path LIKE "A/C/%" AND depth = 3) OR (path LIKE "A/%" and depth = 2)))from LevelInstance t1 Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|