Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select and Update
Message
 
 
To
30/11/2010 17:02:31
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01491203
Message ID:
01491205
Views:
60
This message has been marked as the solution to the initial question of the thread.
--SELECT Color.Title_E,Color2.Title_E AS Title_E2,Color,Color2 FROM RepairOrder

UPDATE RepairOrder FROM RepairOrder
    SET Color2  = Color2.Title_E , Color = Color.Title_E
 LEFT JOIN Color ON RepairOrder.NoColor=Color.Numero
 LEFT JOIN Color AS Color2 ON RepairOrder.NoColor2=Color2.Numero
BTW, why are you using char(40) instead of varchar(40) ?

>I have a SQL like this which gives me a result. The last two fields are empty because I just created them. The goal is to update the result in those two fields with the relational value found:
>
>
>SELECT Color.Title_E,Color2.Title_E AS Title_E2,Color,Color2 FROM RepairOrder
> LEFT JOIN Color ON RepairOrder.NoColor=Color.Numero
> LEFT JOIN Color AS Color2 ON RepairOrder.NoColor2=Color2.Numero
>
>
>So, basically, the first two fields contains the relational value from the color table. The Color and Color2 fields have been added in the RepairOrder table and they are Character(40). How can I use this SQL and turn it into an update to update the Color and Color2 fields with the relational value found in the first two fields?
>
>The reason is that we are dropping the color table as there wasn't any use to keep it. So, we will save the value as is in the character field from now on. But, we need to update the actual records. I thought I would use an approach like that.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform