BigMike
BigMike

Reputation: 1093

SELECT All rows of data but eliminate rows with duplicate data in single column

Would like to grab ALL data from this row, but trying to weed out the duplicate data.

Current query:

SELECT DISTINCT(cDeviceRegistrationID) FROM tblUsers WHERE cDeviceRegistrationID > '';

This returns only the one column of data, but I would like to get all the other data too.

This isn't working for me as it will still return rows with the same cDeviceRegistrationID:

SELECT * FROM tblUsers WHERE cDeviceRegistrationID > '';

Upvotes: 0

Views: 297

Answers (1)

jlee
jlee

Reputation: 492

SELECT * FROM tblUsers WHERE cDeviceRegistrationID > '' GROUP BY cDeviceRegistrationID

This method is preferred since you can take advantage of indexes (index cDeviceRegistrationID).

Upvotes: 3

Related Questions