Hello,
I have a table like the following table:
UserID Num1 Num2 Code Name Cat
7293 32:16.0 50:22.0 3 Jim 33
7293 32:16.0 59:28.0 4 Jim 12
7316 32:16.0 55:32.0 4 Karen 33
7316 32:16.0 28:31.0 4 Karen 7
7287 32:16.0 01:27.0 2 Mike 33
7299 32:16.0 18:53.0 4 Sue 16
7302 32:17.0 54:54.0 4 Bill 28
7302 32:17.0 01:26.0 4 Bill 10
7302 32:17.0 01:26.0 3 Bill 32
and I am trying to select unique rows. I need the output to be this:
UserID Num1 Num2 Code Name Cat
7293 32:16.0 50:22.0 3 Jim 33
7316 32:16.0 28:31.0 4 Karen 7
7287 32:16.0 01:27.0 2 Mike 33
7299 32:16.0 18:53.0 4 Sue 16
7302 32:17.0 54:54.0 4 Bill 28
I am no SQL expert so any help would be greatly appreciated.
I tried using a SELECT statement with DISTINCT, but that only gives me one column, I need the entire row. If I put multiple fields in the SELECT with the DISTINCT it returns all the rows.
Thanks for the assistance.
Ok, to answer some of the replies I recieved:
1) I have tried many queries, but all based around: SELECT DISTINCT UserID FROM MyTable SELECT DISTINCT * FROM MyTable SELECT DISTINCT UserID, Num1, Num2, Code, Name, Cat FROM MyTable
Again, I am not a SQL Expert and everything I read about DISTINCT there is no real example of whatI need.
2) However, reading the replies gave me a thought, since I really only need a few columns, such as UserID, Name,
Can I use DISTINCT and specify those columns only? Hmm, I wil give it a try.
3) I am not sure what the Min, Max stuff is in the replies, but I will try it and hopefully in the process gain a better understanding of the SQL syntax.
Thanks again for the help.