🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2181

A Query Question

#2181
From: Sky
Date: Mon, 29 Sep 2003 13:44
22 lines
1629 bytes
Hi all

I'm a database newbie, does anyone can tell me a simple query question?
I want to insert some record into my table from an old table,
because I set a primary index in my table, so I require that the record
are in-repeated(the index column mustn't repeat).

I know how to query a simgle in-repeated column with distinct keyword,
but I don't know how to query several fields at a time.

this is my sql statement, does anyone can help me compete it?

insert into table1 ( field1, field2, field3)
select fieldA, fieldB, fieldC
from table2

table1 is my table and field1 is the primary key.
table2 is the old table and there are many repeated records(fieldA repeat)

TIA

sky
Technical Details
Message-ID: <3f783748@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!wn14feed!worldnet.att.net!207.115.63.142!prodigy.com!prodigy.com!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,34ec4dec391257d0,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-09-29 06:52:03 PST
From: "Sky" <huangc@motic.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: A Query Question
Date: Mon, 29 Sep 2003 21:44:41 +0800
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 218.104.142.176
Message-ID: <3f783748@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1064843080 218.104.142.176 (29 Sep 2003 06:44:40 -0700)
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-05!sn-xit-09!supernews.com!wn14feed!worldnet.att.net!207.115.63.142!prodigy.com!prodigy.com!logbridge.uoregon.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail