🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: A Query Question

#2182
From: Viatcheslav V. Vassiliev
Date: Mon, 29 Sep 2003 14:04
38 lines
2288 bytes
Define field1 as auto-increment column and do not use it in your sql - DBMS
will generate this value for you. If you need to preserve fieldA, just add
new primary-key column to new table.

//----------------------
Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)


"Sky" <huangc@motic.com> �������/�������� � �������� ���������:
news:3f783748@newsgroups.borland.com...
> 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: <3f783d6a$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f783748@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,34ec4dec391257d0
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-09-29 07:40:13 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <3f783748@newsgroups.borland.com>
Subject: Re: A Query Question
Date: Mon, 29 Sep 2003 18:04:15 +0400
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.234.218.42
Message-ID: <3f783d6a$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1064844650 213.234.218.42 (29 Sep 2003 07:10:50 -0700)
Path: arc1-ca.pugleaf.net!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail