简体   繁体   English

根据另一个字段查找MySQL行的ID

[英]Find the ID of a MySQL row based on another field

I have a line in MySQL with information like the username and email address and I would like to find the id of the row based on the username field. 我在MySQL中有一行,其中包含用户名和电子邮件地址之类的信息,我想根据用户名字段查找行的ID。 Any ideas on how to find the id based on the username field? 关于如何根据用户名字段查找ID的任何想法?

SELECT id FROM users WHERE username = 'NStorm';

这是非常基本的sql:

select id from your_table where username = 'foo'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM