Matches in a database.

Matthew Walker matt at thebraingarden.com
Tue Jun 28 15:25:29 MDT 2005


On Tue, 2005-06-28 at 14:26 -0600, Von Fugal wrote:
> 
> It is doable, and not so hard. What's NOT doable is including step 4 in
> "The One Query".
> 
> Some have given some ideas already, but to specifically return results
> where there ARE duplicates of sessid, something like this...
> 
> select *, count(sessid) as cnt from CDR group by sessid having cnt > 1
> 
> that will give you all occurences where theres a duplicate sessid,
> though you don't know _which_ duplicate row you will get.
> 
> But finding one query aside, why don't you just put a unique key on
> sessid so there cannot be duplicates?
> 
> Von Fugal

Hmmm. I need to learn to use HAVING. I'm self taught, and have always
just used WHERE. Thanks for showing us how to do this.
--
Matthew Walker
The Brain Garden, Inc
matt at thebraingarden.com
Work: (801) 655-1075
Home: (801) 491-2079
Page: (801) 283-9887 (Emergencies Only)

Random Quote:
The difficult we do today; the impossible takes a little longer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://plug.org/pipermail/plug/attachments/20050628/c9e98d30/attachment.bin 


More information about the PLUG mailing list