Re: A problem in SQL (a real challenge)

From: Kyle Lahnakoski <kyle_at_arcavia.com>
Date: 2000/05/16
Message-ID: <3920BF8B.540222F0_at_arcavia.com>#1/1


I do not believe there is a standard SQL method of doing this with one query. Here is a series of commands that will do.

RENAME TABLE <TABLE NAME> TO <TEMP TABLE NAME>; CREATE TABLE <TABLE NAME> AS
SELECT
        <LIST ALL COLUMNS HERE>
FROM
        <TEMP TABLE NAME>

GROUPBY
        <LIST ALL COLUMNS HERE>
;
DROP TABLE <TEMP TABLE NAME>;

There may be a CREATE OR REPLACE command in your version if SQL that replaces the need for a temp table.

Why do you need only one sql statement?

thought wrote:
>
> Suppose I have a table without a primary key (or for that matter
> any key). I want to delete duplicate entries from the table
> using a SINGLE SQL statement. Can anyone there help me out?
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!
 

-- 
----------------------------------------------------------------------
Kyle Lahnakoski                                  Arcavia Software Ltd.
(416) 892-7784                                 http://www.arcavia.com
Received on Tue May 16 2000 - 00:00:00 CEST

Original text of this message