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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 I NEED TO UPDATE THESES RECORDS BASED ON THIS QUER

Author  Topic 

vuyiswamb
Starting Member

6 Posts

Posted - 2007-04-25 : 04:03:56
I NEED TO UPDATE THESES RECORDS BASED ON THIS QUERY


select * from property where
Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
order by Lis_key



HELP ME

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-25 : 04:38:51
Update which table ? Which column to update ? Update with what value ?


KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-25 : 04:49:25
[code]Update p
set <SomeCol> = <Somevalue>
From Property
where
substring(func_key,1,5)='GEOSS'
And cast(substring(func_key,6,8) as integer) >= 3 and
and substring(Attrib_code,5,2) <> '16'
and Active = 1[/code]

Your requirement looks conflicting to me... You want records where substring(func_key,1,5)='GEOSS' and also Func_key = 'PV000000'. What does that mean?

Post some sample data to back your question.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-25 : 04:52:31
Harsh, you missed the table alias p
Update p
set <SomeCol> = <Somevalue>
From Property p



KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-25 : 04:56:07
quote:
Originally posted by khtan

Harsh, you missed the table alias p
Update p
set <SomeCol> = <Somevalue>
From Property p



KH





Oops! Thanks KH.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -