Hi all
I've got a SQL table. It's got eight columns: two UUID (nvarchar 35),
two date (datetime 8), three text fields (nvarchar 50) and one
autonumber (int 4).
The purpose of this table is to relate the "users" table to the
"activities" table. To make thinks perfectly confusing ;-), the
architect decided to call the table in question "users_activities". The
two UUID columns are not unique within themselves. When combined across
a row, they should then be unique. Problem is, they aren't. I've tried
writing a couple of SQL queries to eradicate the dupes ... but my
knowledge of SQL isn't what it needs to be to solve this problem.
So, here's the query I came up with:
SELECT
youth_UUID,
activity_UUID,
count(youth_UUID) AS yUID_count,
count(activity_UUID) AS aUID_count
FROM
USERS_ACTIVITIES
GROUP BY
youth_UUID, activity_UUID
HAVING
count(activity_UUID) > 1
This query returns 434 rows from a table of 27840 rows.
How would I use this query as a subquery? My desire is to use this query
as the WHERE clause in a INSERT and DELETE FROM queries. Could some one
show me the best way to do this?
Is there a better way to combine two values to search for dupes?
Any help is greatly appreciated!
* John *
engineer
circle.com/boston
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message
with 'unsubscribe' in the body to [EMAIL PROTECTED]