|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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' ![]() |
|
#2
|
|||
|
|||
|
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') |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > SQL update query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|