Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Insert into..Select From sql query help

Author  Topic 

ManuAdam
Starting Member

1 Post

Posted - 2009-09-02 : 05:49:49
Please help me! For many days I have been trying the sql query to INSERT data from one table to another in the same database, but everytime I am getting this error message: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fulltext) VALUES(SELECT title, description, article_text FROM jos_a3000_article' at line 1.
My problem: I have to insert data from table: jos_a3000_articles That has columnheads like: (id, cat_id, title, description, article_text, pub_date, hash) into another table jos_content That has columnheads (`id`, `title`, `title_alias`, `introtext`, `fulltext`, `state`, `sectionid`, `mask`, `catid`, `created`, `created_by`, `created_by_alias`, `modified`, `modified_by`, `checked_out`, `checked_out_time`, `publish_up`, `publish_down`, `images`, `urls`, `attribs`, `version`, `parentid`, `ordering`, `metakey`, `metadesc`, `access`, `hits`, `metadata` )

I tried sql query like:
INSERT INTO jos_content (title,introtext,fulltext)
SELECT title, description, article_text
FROM jos_a3000_articles;

It failed. Then I tried:
INSERT INTO jos_content(title, introtext, fulltext) VALUES("SELECT title, description, article_text FROM jos_a3000_articles")
That again showed the syntax error. Please help where am I making mistakes and what shouldbe the right query in such case of mismatched columns. And specially , if I want to put all the content from jos_a3000_articles into a particular section of jos_content.. what should be the right Query. I would be highly obliged for your kind expert's help. Thanking you.






madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-02 : 05:54:43
This site is for MS SQL Server. Post your question at www.mysql.com


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -