Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

infomix query

Status
Not open for further replies.

robertgi

IS-IT--Management
Mar 17, 2015
1
GB
Hi ruining informix 7.23

looking to updaqte values on one table to a fixed value if the criteria from another table is true. As an example
I want to update the fcoemplocsting.soc_Costgrp to xxx
if the value in another table is true, selection below as an example.

Within the fcoemposting table can have multiple records with same emp_code but on the Taem table only ever one taem1_employee_employee. So in essence a Many to one.

SELECT fcoempcosting.soc_costgrp
FROM mtmsadm.fcoempcosting fcoempcosting, mtmsadm.taem_data taem_data
WHERE fcoempcosting.emp_code = taem_data.taem1_employee AND ((taem_data.taemcostcentre='59084'))

How do i modify the update statement to include the from table?
 
Something like this ?
UPDATE fcoempcosting SET soc_costgrp='xxx'
WHERE emp_code IN (SELECT taem1_employee FROM fcoempcosting WHERE taemcostcentre='59084')


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry for the typo:
UPDATE fcoempcosting SET soc_costgrp='xxx'
WHERE emp_code IN (SELECT taem1_employee FROM taem_data WHERE taemcostcentre='59084')

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top