Microsoft
Software
Hardware
Network
Question : SQL 2005 Update Query??
Trying to update some data in a table named 'Servmed'. See below for a sample of what I want to update (field names are underlined):
Level1 Servcode activerate billtype
1 B 1.0000 S
6 BO 2.0000 S
6 BO 1.6700 C
27 BO 2.0000 S
27 BO 1.6700 C
29 BO 2.0000 S
29 BO 1.6700 C
'Level1' identifies a customer - most customers have two rows for servcode='BO', for these rows, I want to update the activerate in the row with a 'S' for billtype to match the activerate in the row with 'C' for billtype. The rates vary from customer to customer, so I can't just update all with the same. Some customers only have one billtype, so just one row is returned... they can be excluded.
Any suggestions?
Answer : SQL 2005 Update Query??
update Servmed
set activerate = (select activerate
from Servmed B
where B.Level1 = Servmed.Level1
and B.Servcode = Servmed.Servcode
and B.billtype = 'C')
where Servmed.Servcode = 'BO' and Servmed.billtype = 'S'
Random Solutions
Testing someone webdesign knowledge
how to get authorized certificate for two domains for SBS 2008?
how can I refresh my datagridview without using a refresh button?
Outlook Business Contact Manager 2010 load fails
select count(distinct *)
BIND DNS Server Logs full of "unexpected RCODE (SERVFAIL)"
Adapting an existing query to include counts & maxrows
Excel - worksheet one gray screen
How to create website in Joomla. Can any one send example.
my dell vostro latop 1015 and wifi trouble using windows 7 ultimate