1

I know how to get rows in MySQL, but what about if I have two rows with the same key and I want to get the two rows?

For example

"SELECT * FROM test WHERE (key_exaple = ?)"

The ps.setString(1, "test");

But let's imagine that I have two rows with the "test" key.

How can I get them one by one?

Strawberry
  • 33,750
  • 13
  • 40
  • 57
Zwoosks
  • 11
  • 1

1 Answers1

0

Assuming your 'ps.' stands for PreparedStatement, you can use:

SELECT * FROM test WHERE key_exaple in (?, ?)

ps.setString(1, "test");
ps.setString(2, "second test");

this might help

YoManTaMero
  • 391
  • 4
  • 10