question

pusumuluri avatar image
pusumuluri asked

i want to develop a tool to update one field by selecting that tool it should take the minimum value of that field

i want to develop a tool to update one field by selecting that tool it should take the minimum value of that field
sql-server-express
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pusumuluri avatar image pusumuluri commented ·
for suppose i selected 10 events in that a field "LastOccurrence" is there the condition is if i select the all 10 events and run that tool it should select the minimum value from those values in the fiels and that should be updated with a number
0 Likes 0 ·
pusumuluri avatar image pusumuluri commented ·
its not working sir.. my database is sybase.. plz help me to resolve this problem
0 Likes 0 ·
eghetto avatar image eghetto commented ·
In that case (if my understanding is correct) try this: UPDATE MyTable SET MyValue = MyNewValue FROM dbo.MyTable WHERE MyValue = (SELECT MIN(MyValue) FROM MyTable)
0 Likes 0 ·

1 Answer

·
eghetto avatar image
eghetto answered
Just to give you an idea where to start (quick & dirty): UPDATE MyTable SET MyValue = (SELECT MIN(MyValue) FROM MyTable) FROM dbo.MyTable
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.