开发者

Result id from database by mysql?

开发者 https://www.devze.com 2023-02-25 13:29 出处:网络
I have a column in database saved as id like 1,12,10 and I 开发者_C百科want to return only one id like 1 or 12 or 10 when use like will return wrong data? What can I do?You can use LIMIT.

I have a column in database saved as id like 1,12,10 and I 开发者_C百科want to return only one id like 1 or 12 or 10 when use like will return wrong data? What can I do?


You can use LIMIT.

SELECT col FROM table_name LIMIT 1

This will only return one result.

However you are claiming that it is returning the wrong results, which we can't help if you don't post more.

Update

as per your comment, you want to use IN

SELECT col FROM table_name WHERE id IN (10, 12, 1)
0

精彩评论

暂无评论...
验证码 换一张
取 消