You are here: Update One Based on ANother Table « MsSQL Server « IT news, forums, messages
Update One Based on ANother Table

Posted by Mike on 10/13/05 16:11

Here is my situation;

I have two tables in a MS-SQL DB. One table with dollar amounts and service
codes. I have a second table that I want to move some information into from
the first table. The catch is I want to move one field as is from the first
table to the second, but the rest of the fields in the second table are
calculations based on fields in the first table.

The first table is called XFILE. It has fields SVCCODE, PRICE, DWAGES,
DMATLS, etc. The second table has the same field names and I want to move
the SVCCODE from XFILE to Cost_Percent with no changes. For DWAGES in the
Cost_Percent table I want to do the following calculation;

[ XFILE.DWAGE] divided by [XFILE.PRICE] and put the results in Cost_Percent
table DWAGES field

So basically I am putting a percent in the Cost_Percent table. I can move
the data from one table to another ok, but I can not figure out how to write
the query in the Query Analyzer to do this.

I am ruining SQL2000 Standard on a Win2K3 server. I am using Query Analyzer
and SQL Enterprise Manager from an XP-Pro WS.

I have looked in the 'Books On-Line' for the answer but I sort of new to SQL
and can't find the answer that I am sure is staring me in the face.

Thanks in advance for any help.

Mike Charney
m charney at dunlap hospital dot org

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация