Greetings, I need help with a select statement that finds duplicate sets of rows.
I have a table like so: batch_data ----------------------- ID - int (auto inc) Record ID - int DataValue - VarChar(99) DataType - int With a sample of data like this: 1 100 1122A 1 2 100 1350G 1 3 100 1001 2 4 101 1122A 1 5 101 1350G 1 6 101 1002 2 7 102 8493P 1 8 102 1003 1 What I want to do is return the DataValue where theDataType = "2" of the duplicate set of matching datavalue records where data type = "1". In this case I want the value of "1002" returned (from row 6) because there are 2 matching DataValue rows, 1 & 2, which match rows 4 & 5. A set of DataValue's is defined by the RecordID. So set 1 consists of rows 1 to 3, set 2 is 4 to 6, and set 3 is rows 7 & 8. Is this possible to do in one SELECT statement, or should I just iterate through a resultset in my application? Thanks in advance, -- James Neff -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]