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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add new fields to a table

Status
Not open for further replies.

szaunbr

Technical User
Jul 5, 2006
50
US
Hello. I am working with an informix db and am trying to add two new deduction to every employee that is in a specific group.

I have one table, deduction, that I need to add a deduction code (2020) to every employee in group 'B'. The group is stored only in the employeemaster table. The common link between the two tables is the emp number.

I tried this:

insert into deducton (ded_code)
values ('2020')
where emp in (select emp from employeemaster where group='B');

but that is giving me a syntax error on the values line.

 
is ded_code a string or a number? you are trying to enter a string (since it has ', you may need to actually use " instead). If it's a number, take out the quotes.


Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases:
The Fundamentals of Relational Database Design
Understanding SQL Joi
 
It is a number. I took out the quotes, and now it is giving me a syntax error on the where clause.
 
so the table deduction has ded_code and emp?

and employeemaster has emp and group?

are you sure the field names are correct for each table?

and this is the query you are trying?

insert into deducton (ded_code)
values (2020)
where emp in (select emp from employeemaster where group="B");

when you say: that didn't work either....do you mean you got an error message? what was it? the query ran, but didn't do anything?

leslie
 
I've got it now. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top