Sql

pts.
Tags:
DB2 Universal Database
When I execute this Sql command. I get an error "Column BASEDATA1 not in specified tables." I have a field in IN$FPS00 that I want to include in 'where' condition and update the rest of the fields in this file. Field Basedata1 is in the table. UPDATE IN$FPS00 SET I@R01 = Sum(BaseData1) WHERE EXISTS(Select BaseData1 FROM si280061 a, si280062 b,in$fps00 c WHERE a.hierarchyid=b.hierarchyid) AND (datatype='SI') AND (salesinfotype IN ('I01','I04' )) AND hlevel20=fp$sku)

Answer Wiki

Thanks. We'll let you know when a new response is added.

You used:
UPDATE IN$FPS00
SET I@R01 = Sum(BaseData1)
WHERE EXISTS(Select BaseData1 FROM si280061 a, si280062 b,in$fps00 c WHERE
a.hierarchyid=b.hierarchyid) AND (datatype=’SI’) AND (salesinfotype IN (‘I01′,’I04′ ))
AND hlevel20=fp$sku)

You’re trying to pull BaseData1 from one of the SI files, but you’re specifying that it should come from IN$FPS00. You’re also using more copies of in$fps00 than you think. I would rewrite the code for you, but you must do these things first:
(1) Balance your parentheses
(2) Qualify all names. For instance, datatype should be a.datatype, b.datatype, or c.datatype.

Sheldon Linker (sol@linker.com)
Linker Systems, Inc. (www.linkersystems.com)
800-315-1174 (+1-949-552-1904)

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following