"David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
news:etdhRVQiHHA.4032@TK2MSFTNGP02.phx.gbl...
> "GotDotNet?" <csharpcoder@optonline.net> wrote in message
> news:%23NRGRPQiHHA.5008@TK2MSFTNGP02.phx.gbl...
>>I have to do an insert on a table were 1 column needs to comes from tableA
>>other columns need to come from tableB.
>>
>>
>> so I have table A
>> Downloaded
>> Location
>>
>> Table B
>> Name
>> Address
>> City
>> State
>> ZipCode
>>
>> now the table I need to insert needs the following
>> Name
>> Address
>> City
>> state
>> ZipCode
>> Downloaded
>>
>> i know I can do a insert into tableC (name, adderss, city, state,
>> zipcode) select (col1,col2,col3,col4,col4) from tableb
>>
>> how can i get the download field in table A to insert into tableC?
>>
>>
>>
>
> You have a set of values for Downloaded but you haven't explained how we
> are to know which of those values goes with which address in TableB.
>
> I'll assume you'll want a join on some criteria that you haven't
> specified. Example:
>
> INSERT INTO TableC (name, address, city, state, zipcode, downloaded)
> SELECT B.name, B.address, B.city, B.state, B.zipcode, A.downloaded
> FROM TableA AS A
> INNER JOIN TableB AS B
> ON A.something = B.something AND .... ??? ;
>
> HTH
>
> --
> David Portas, SQL Server MVP
>
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
>
> SQL Server Books Online:
>
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>
>
>
>
>
>
>
>
>
>