To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Related Sites > SQL Course

SQL Course SQL Course > Ask questions about the lessons on SQL Course 1 and 2. If you have problems > with the interface, please post in the Feedback forum

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-31-2002, 02:22 PM
redsfan redsfan is offline
Junior Member
 
Join Date: Oct 2002
Posts: 1
Simple SQL insert

Hi there, i'm not that good with SQL scripts and any help would
be appreciated.

I have two tables with a field in each, containing string data,
I want to merge the data from these two fields, into a single
field within another table in the database, i know its probably
pretty simple and i'm being lazy asking you lot but i'm pretty
busy and havn't got time.

thanks for any help
Reply With Quote
  #2  
Old 11-04-2002, 09:06 AM
franz franz is offline
Junior Member
 
Join Date: Oct 2002
Location: Boston
Posts: 5
Inserts

Your description is not complete -- or the problem is not solvable. Essentially, you need to join your tables together. Since each contains a single text column, there does not seem room for a key - unless you left that information out. Repost showing the structure of both tables in their entirety, including key fields. If you are relying on the "order" of data in the database, it will depend on your dbms. If you have Oracle or have Sybase or MSSQL with a clustered index, your "order" is already lost (there may be a way to recover it in MSSQL if you have not clustered, but the level of effort required would be greater than reentering the data unless you have thousands of records).
Reply With Quote
  #3  
Old 11-18-2002, 07:15 PM
bamcorp bamcorp is offline
Junior Member
 
Join Date: Nov 2002
Posts: 8
Assuming your source tables are linked:

Table a = source one
Table b = source two
Table c = destination

you could use a query something like this. You will have to use convert if the fields are a number type.

insert into c
select a.id, a.source_one + ' ' + b.source two
from a inner join b on a.id = b.id
Reply With Quote
Reply Post New Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:47 AM.


DatabaseJournal Recent Articles


 » Grouping with SQL Server 2008

 » Conducting Service Broker Conversation Usi...

 » Applying data warehousing principles to ev...

 » Oracle New Year's resolutions, part 1: Adv...

 » Hands on: Understanding SQL queries

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.