I am trying to create a sql statement to do the following:

table contains:
pub
email
status
opt_in_date

select * from tablename where (select count(distinct field1 + ' ' + field2)
> 1) and status = 1 order by email

I know it's not that simple, I got as far as this:

SELECT DISTINCT email + ' ' + pub AS DistinctValue, COUNT(DISTINCT email + '
' + pub) AS DistinctCount, record_id, email, pub, status
FROM         opt_in_master
WHERE     (status = 1)
GROUP BY email, pub, record_id, status
ORDER BY email, pub, record_id, status

but can't figure out how to select only records where DistinctCount > 1.

Any pointers would be appreciated!

TIA

Susan H. Allen
Web Applications Developer
Pfingsten Publishing, L.L.C.
Cleveland, Ohio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6
Get the mailserver that powers this list at http://www.coolfusion.com

                        

Reply via email to