How to update base on parameter vaues in other table

  • Hi

    I have two table details and parameter.

    I want to update Type_score,Amount_score,Age_score acording to the criteria given in the #para table.

    Please help me as I need this urgently.

    drop table #Temp

    Create Table #Temp

    (

    Number Int,

    Type Varchar(100),

    Amount Int,

    Age Int,

    Type_score Varchar(100),

    Amount_score Int,

    Age_score Int

    )

    drop table #para

    create table #para

    (

    Id varchar(100),

    Type Varchar(100),

    valueFrom Int,

    valueTo Int,

    score Int

    )

    Insert Into #Temp(Number,Type,Amount,Age)

    Values (1,'Vannila',1000,20)

    Insert Into #Temp(Number,Type,Amount,Age)

    Values (2,'Strawberry',2500,40)

    Insert into #para

    Values ('Product','Vannila','','',5),

    ('Product','Strawberry','','',1),

    ('Age','',18,25,5),

    ('Age','',26,30,1),

    ('Amount','',1000,2000,5),

    ('Amount','',2001,3000,1)

    Select * from #Temp

    Select * from #para

    Thanks in Advance!

  • So what do you want the fields in #Temp to be from #Para? If you're looking for a simple update, just use UPDATE FROM and match on Type.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply