Oskar Pearson on Wed, 12 Mar 2003 10:43:23 +0200 (SAST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Linux dev] Re: SQL duplicate entries


Hi

I'm not sure if the DB you are using will support this,
but you should be able to do something like this:

select
	count(*)
    from
	Log
    group by
	h323_conf_i
    having
	count(*) > 1

That works in SQL server (or will with minor modification), probably
Sybase too.

Oskar

On Wed, Mar 12, 2003 at 12:40:34AM +0200, Hendrik Visage wrote:
> Hi there,
> 
>  I'd like to find duplicate entries for a SQL table.
> ie. only the duplicate entries for a certain key. (preferably Postgres,
> but open for examples/suggestions from other RDBMS)
> 
>  The problem behind the question is that I have RADIUS accounting logs that
> appears to contain duplicate entries (h323_conf_id which should be unique),
> and I'd like to compare the duplicate h323_conf_id entries to see if it's
> a "legal" duplicate entry (ie. Radius "double" logging because of network
> troubles etc.) or a re-use/cross-use of h323_conf_ids in this/other routers.
> 
> I'll consider doing a primary key on the full record only as a last resort for
> performance reasons :(
> 
> (And before anybody ask, no, it's not a VoIP network that's in ZA :()
> 
> Hendrik
> 

--
Oskar Pearson <oskar@xxxxxxxxxxx>
Qualica Technologies (Pty) Ltd
web: http://www.qualica.com/