| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-03-15 : 10:02:03
|
| AJ writes "I have two tables which are exactly alike. What I want to do is copy an entire column(the descriptions)from one table and put that information into the other table's description column where the ID matches up. Is there a way to go about doing this?Thanks,AJ" |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2002-03-15 : 10:27:39
|
| UPDATE table1 SET column(the descriptions in table 1) = t.column (the descriptions from table 2) FROM table2 t, table1 s WHERE t.id = s.idThis basic example in avaiable in BOL under Title: UPDATE Location: Transact-SQL Reference Rank: 41.Jeremy |
 |
|
|
morningsidebooks
Starting Member
4 Posts |
Posted - 2002-03-18 : 10:37:29
|
| The table that I want the descriptions to be put into is called ebooks, and the table that I want the descriptions to come from is called ebooks2 and the "ID" is called BOOK. This is what I typed in.UPDATE ebooksSET DESCRIPTION = t.DESCRIPTIONFROM ebooks2 t, ebooks sWHERE t.BOOK = s.BOOK;Was that correct? I got ERROR 1064 You have an error in your SQL syntax near 'FROM ebooks2 t, ebooks sWHERE t.BOOK = s.BOOK' at line 3 |
 |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-03-19 : 00:21:43
|
| UPDATE t SET t.DESCRIPTION = s.DESCRIPTIONFROM ebooks t inner join ebooks2 son t.book=s.bookHTH-------------------------------------------------------------- |
 |
|
|
morningsidebooks
Starting Member
4 Posts |
Posted - 2002-03-19 : 11:32:06
|
| The last post did not work eitherI got the same error, "Error 1064 You have an error in your SQL syntax near 'FROM ebooks t innerjoin ebook2 s on t.BOOK=s.BOOKHopefully there is another way to go about doing this. |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-03-19 : 13:27:16
|
what are you using?SQL Server error 1064 is 'A filegroup cannot be used with log files.'.quote: I got the same error, "Error 1064 You have an error in your SQL syntax near 'FROM ebooks t innerjoin ebook2 s on t.BOOK=s.BOOKHopefully there is another way to go about doing this.
setBasedIsTheTruepath<O> |
 |
|
|
morningsidebooks
Starting Member
4 Posts |
Posted - 2002-03-20 : 10:53:26
|
| I log onto the server using telnet and type all my commands in there once i'm logged in. |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-03-20 : 11:24:44
|
| right ... are you using SQL Server I mean? the error code coming back from whatever SQL client you're using does not match the documented error message that SQL Server would send.Given that you're using telnet, i'll hazard a guess that you're connecting to ... oracle?setBasedIsTheTruepath<O> |
 |
|
|
Arnold Fribble
Yak-finder General
1961 Posts |
Posted - 2002-03-20 : 15:33:50
|
Worse! mySQL |
 |
|
|
chrispy
Posting Yak Master
107 Posts |
Posted - 2002-03-20 : 18:26:25
|
| Worse yet! MS SQL on a WIN 2k box with Telnet enabled. |
 |
|
|
rrb
SQLTeam Poet Laureate
1479 Posts |
Posted - 2002-03-20 : 19:12:39
|
I believe the oracle form would be:Update ebooks tset t.desc = (select s.descfrom ebooks swhere s.book = t.book )from memory - but it's been a looooooooooooooooooooong time --I hope that when I die someone will say of me "That guy sure owed me a lot of money" |
 |
|
|
morningsidebooks
Starting Member
4 Posts |
Posted - 2002-03-22 : 09:54:09
|
| It is a MySQL Server runnuing Ver 11.16 Distrib 3.23.49 |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-03-22 : 09:58:06
|
| Head over to http://dbforums.com and check their mySQL forum, they will probably be able to help you with this one. |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-03-22 : 09:58:59
|
Then, unfortunately, you're in the wrong place ...  quote: It is a MySQL Server runnuing Ver 11.16 Distrib 3.23.49
setBasedIsTheTruepath<O> |
 |
|
|
|