update question



Hello,
I am new to working with SQL and I have a few questions. One the
update query below, one will it work and I looking for a better
understanding of the steps that are taking when this query runs. This
is in Interactive sql. Only a certain number of records need to be
update in the address table based off a particular address in the
tblee.

tbladdress
id int
street address varchar
phone varchar
fax varchar

tblmain
id int
lastname varchar
firstname varchar

tblee
id int
sales_address varchar

begin tran

update tbladdress
set phone = 'xxxxxxxxx',fax = 'yyyyyyyyyy'
from tbladdress y inner join
(
select phone, fax from tblmain m
join tblee a on m.id = a.id
where phone is null and fax is null
)b join b.id = y.id
where y.phone is null and y.fax is null

commit tran

I would think and correct me if I am wrong that these type queries
first pull the data from the selected statement and then will update
the join on the records returned?

Any help would be great

.



Relevant Pages

  • Re: Weird Cast operator
    ... Please refer to @outFails sql from my ... The datatype of this CASE expresion is varchar. ... the value of the CASE expression is int. ... in the SQL datatype precedence list. ...
    (microsoft.public.sqlserver.programming)
  • Re: Weird Cast operator
    ... (like in the first sql in my posting), server has to do CAST(@in AS ... INT) in order evaulation the whole expression, ... > CASE can only return a single datatype. ... > is INT and the other VARCHAR. ...
    (microsoft.public.sqlserver.programming)
  • Re: Db2dclgn Indicator variables
    ... It is true that "49-levels" are used by most SQL products for holding ... I'd love to see a COBOL that supports the ANY LENGTH PREFIXED ... clause for a much more natural VARCHAR. ... I'd also love to see some kind of COBOL support for "null" values. ...
    (comp.lang.cobol)
  • Re: how to insert xml into sql 2005
    ... For right now I just know I have to get this into the sql database. ... to XML processing no matter how big the XML document is. ... ,captionnohtml varchar 'CaptionNoHTML' ...
    (microsoft.public.sqlserver.xml)
  • Complicated query
    ... QTopic [varchar 50] ... Term [int] - Validity in months from the current date. ... The problems are to write a query to get the question list for a patient ...
    (microsoft.public.sqlserver.programming)