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

HELP, ASAP

Status
Not open for further replies.

gotmilk2

Programmer
Jan 24, 2006
10
US
THE FOLLOWING SQL GETS A ERROR ON THE "FROM" VERB, WHY?

UPDATE BIZ.RDS_SALES_DTL SD1
SET RSRV_UNITS= SD1.RSRV_UNITS+SD2.RSRV_UNITS),
SALE_UNITS=(SD1.SALE_UNITS+SD2.SALE_UNITS),
SALE_DLRS=(SD1.SALE_DLRS+SD2.SALE_DLRS),
RTRN_UNITS=(SD1.RTRN_UNITS+SD2.RTRN_UNITS),
RTRN_DLRS=(SD1.RTRN_DLRS+SD2.RTRN_DLRS)
From BIZ.RDS_SALES_DTL SD2
Inner Join BIZ.RDS_SALES_DTL SD2
ON SD2.SELL_DIVN_NBR = 63
And SD2.ZL_DIVN_NBR = 47
And SD2.RDS_SKU_NBR = 34
AND SD2.SALES_DT = '12/26/2006'
WHERE (SD1.SELL_DIVN_NBR = 40)
AND (SD1.ZL_DIVN_NBR = SD2.ZL_DIVN_NBR)
AND (SD1.RDS_SKU_NBR = SD2.RDS_SKU_NBR)
AND (SD1.SALES_DT = SD2.SALES_DT)
 
Missing assignment of proper alias, strange mixture of ANSI-92 join syntax with 'old' syntax.
The where predicates are misplaced with the joins.

but what are you attempting with the self-join in any case?

Ties Blom

 




in other words...
Code:
From BIZ.RDS_SALES_DTL [red][b]SD2[/b][/red]                      
Inner Join BIZ.RDS_SALES_DTL [b]SD2[/b]

Skip,

[glasses]I'll be dressed to the nines this week, as I go to have my prostatectomy...
Because, if I'm gonna BE impotent, I want to LOOK impotent![tongue]
 
Also, not all, if any, versions of DB2 support that syntax to do updates.

What is the version of DB2 and OS you are trying it on?

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Thanks for the replys.

I have tow(2) sets of data on the same database table. I want to update one of the two with the other if the keys match between the two (exception on the key is the sell_divn_nbr).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top