Wednesday, March 21, 2012

Multiple entries script...help

Ok,
In one table, I need to find all instances of multiple entries of an
invoice number in the column InvoiceNumber.

For example, there may be more than one entrie of 321, 567, and 987
in column InvoiceNumber.

321 skin care product
321 vitamins
321 bottled water

567 rubbing alcohol
567 dental floss

987 fabric softener
987 tissue paper
987 marlboro cigaretts

Any help is appreciated.
Thanks,
Trintselect InvoiceNumber, count(*) as 'Occurrences'
from dbo.MyTable
group by InvoiceNumber
having count(*) > 1

Simon|||Simon,
Thanks!
Trint

..Net programmer
trinity.smith@.gmail.com

*** Sent via Developersdex http://www.developersdex.com ***

No comments:

Post a Comment