0

I'm using the following SQL code to search through my MySQL database:

SELECT a.* FROM clients a JOIN (SELECT email, COUNT(*) FROM clients GROUP BY email HAVING count(*) > 1 ) b ON a.email = b.email ORDER BY a.email

. However, after my search, the rows come up and it says: Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.

Yet the column clientID, which is marked as a primary key is there, but I still cannot edit. What is the problem?

This is what my clientID structure is.

This is my clientID structure.

This is what the search returns

This is what the search returns. Also before anyone mentions it, the passwords are hashed.

Thanks!

ADyson
  • 57,178
  • 14
  • 51
  • 63
Tim Rumit
  • 37
  • 2
  • 11
  • 2
    I suspect the join is your issue. – ceejayoz Jan 23 '20 at 19:58
  • I believe it's referring to the unique index, which is missing from one or more rows (resulting from your join). See this question: [PHPMyAdmin 4.0.5 - Grid edit, checkbox, Edit, Copy and Delete features are not available](https://stackoverflow.com/questions/18748073/phpmyadmin-4-0-5-grid-edit-checkbox-edit-copy-and-delete-features-are-not-a/18748488) – EternalHour Jan 23 '20 at 20:05
  • @EternalHour but clientID column is already set as the primary index. Which is unique no? – Tim Rumit Jan 23 '20 at 20:08
  • 2
    @TimRumit yes, but it's _not_ (or potentially not) unique in the context of the query results (because of the join, as EternalHour mentioned) – ADyson Jan 23 '20 at 20:27

1 Answers1

1

I changed the SQL query to the following:

select * from clients a where ( email ) in ( select email from clients group by email having count(*) > 1 )

Now it works with editing and deleting etc..

Tim Rumit
  • 37
  • 2
  • 11