Query to insert from one field into another

  • Thread starter Thread starter Gav
  • Start date Start date
G

Gav

This is actually a query I want to do in Sql server but I expect the
statement should be the same. Is there a way I can set a particular column
to the same as another. ie

where it is

col1 col2 col3
1 2
2 5
3 6
4 12

Set col3 to the same as 2 so it would then be:

col1 col2 col3
1 2 2
2 5 5
3 6 6
4 12 12

Thanks in advance for the help
Gav
 
SELECT col1, col2, cols AS col3
FROM tablename
or
Update tablename
set col3=col2

May
MCP in Access and SQL Server
 
Just add some resource, there is detailed description including samples:

UPDATE
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_
ua-uz_82n9.asp


Sincerely,

Alick Ye, MCSD
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.



--------------------
| From: "Gav" <[email protected]>
| Subject: Query to insert from one field into another
|
| This is actually a query I want to do in Sql server but I expect the
| statement should be the same. Is there a way I can set a particular column
| to the same as another. ie
|
| where it is
|
| col1 col2 col3
| 1 2
| 2 5
| 3 6
| 4 12
|
| Set col3 to the same as 2 so it would then be:
|
| col1 col2 col3
| 1 2 2
| 2 5 5
| 3 6 6
| 4 12 12
|
| Thanks in advance for the help
| Gav
|
|
|
 
Back
Top