There are multiple pieces of the same data in mysql except for ID, and only one of them is taken (user login)

        In the process of building a user table and testing, it is found that there may be multiple data with the same username and password in the table. When logging in, a user object needs to be returned, but a simple select statement returns a list, which can be replaced by the following sql statement

SELECT `username`,`password` FROM t_users WHERE `id` = (SELECT MIN(`id`) FROM `t_users` WHERE `username`='admin' AND `password`='admin')

 can achieve one of the

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326528180&siteId=291194637