Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 16th, 2004, 03:43 AM
huckleberry huckleberry is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 26 huckleberry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 sec
Reputation Power: 0
Question SQL update query

Hi, Can someone please help me with this SQL update query. Hopefully its fairly obviosu what I am trying to do but the syntax is wrong .... missing expression.

update subscriber_questions set answer_text = 'Employ\u00E9'
where
(select a.answer_text from subscriber_questions a, subscribers b
where b.subscriber_code = a.subscriber_code
and b.site_id = 'XXX'
and a.country_iso_code = 'UK'
and a.question_code = 'OCCUPATION'

Reply With Quote
  #2  
Old July 16th, 2004, 07:36 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
update subscriber_questions set answer_text = 'Employ\u00E9'
where NOT EXISTS | EXISTS
(select a.answer_text from subscriber_questions a, subscribers b
where b.subscriber_code = a.subscriber_code
and b.site_id = 'XXX'
and a.country_iso_code = 'UK'
and a.question_code = 'OCCUPATION')

You suppose to compare the returning value of subquery with the column of outer query or just check the existance or non existance (only use EXISTS or NOT EXISTS at a time not both in a single search condidtion)of some value in the subquery as mentioned above.
To compare the value of subquery with the outer query column, use the following example:

update subscriber_questions set answer_text = 'Employ\u00E9'
where answer_text =
(select a.answer_text from subscriber_questions a, subscribers b
where b.subscriber_code = a.subscriber_code
and b.site_id = 'XXX'
and a.country_iso_code = 'UK'
and a.question_code = 'OCCUPATION')

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > SQL update query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway