Operand should contain 1 column(s) in java

mysql, mysql-error-1241

Solution

Correct way is

String  sql = "SELECT Employee_name, Password FROM employee WHERE Employee_name = '"+name+"'  AND Password = '"+password+"'";

You can keep `()` for where clause but not in select list. This is what happens in your case

mysql> select (firstname,email) from users limit 1 ;
ERROR 1241 (21000): Operand should contain 1 column(s)

Problem

``` String sql = "SELECT (Employee_name, Password) FROM employee WHERE (Employee_name = '"+name+"' AND Password = '"+password+"')"; ``` and getting the following exception in JSP java.sql.sqlexception insert operand should contain 1 column(s) Please help.

Original source

Related problems