根据ID从表中选择多行

时间:2021-03-22 19:45:29

I have a table like this:

我有这样一张桌子:

ID  KEY
15  hello
16  world
17  done

I want to select rows 15 and 17. I tried this:

我想选择第15行和第17行。我试过这个:

SELECT * FROM USERSMETA where ID=15,17

But it’s not working. What can I do instead?

但它不起作用。我该怎么办?

2 个解决方案

#1


1  

Try this

SELECT * FROM USERSMETA where ID in(15,17);

OR

SELECT * FROM USERSMETA where ID=15 OR ID=17;

#2


0  

You could try this to get these two rows (not columns)

您可以尝试这样来获取这两行(而不是列)

SELECT * FROM USERSMETA WHERE ID = 15 OR ID = 17

#1


1  

Try this

SELECT * FROM USERSMETA where ID in(15,17);

OR

SELECT * FROM USERSMETA where ID=15 OR ID=17;

#2


0  

You could try this to get these two rows (not columns)

您可以尝试这样来获取这两行(而不是列)

SELECT * FROM USERSMETA WHERE ID = 15 OR ID = 17