ali raza

C#, .Net ,Asp.net and my thoughts

update statement with select in teradata

hi all, i use following syntex for this


UPDATE T1 FROM (SELECT t2_1, MIN(t2_2) from T2 group by 1) as D (D1, D2)
SET Field2 = D2
WHERE Field1 = D1

 

So i solve my problem as

UPDATE XTZ.KPI FROM (SELECT CONVERTED_TARGET_QTY,NORMAL_VALUE,CRITICAL_VALUE FROM DP_UTL.PRODUCTION_KPI WHERE PACKAGE='SSPET-500') AS D(D1,D2,D3) SET
MaximumValue = D1
, NormalValue = D2
, CriticalValue = D3
WHERE KPIId=125;

 

Chears

2 responses to “update statement with select in teradata

  1. Bhidu March 4, 2009 at 8:56 am

    Thanks very much for this. It really helped when I needed it!!

  2. Philippe May 12, 2009 at 12:20 pm

    Thank you very much !
    Teradata syntax is pretty much different from Oracle’s one …

    Very useful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: