Hi.
So let's take this table for example, we call it Messages
![[Image: ab0253305a04481ed9d3806ccfaa51bc.png]](https://gyazo.com/ab0253305a04481ed9d3806ccfaa51bc.png)
By default, receiver value is always NULL.
I am trying to display all Messages where receiver is NULL.
But how?
Since this wont work.
This is the error message
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NULL' at line 1
So let's take this table for example, we call it Messages
![[Image: ab0253305a04481ed9d3806ccfaa51bc.png]](https://gyazo.com/ab0253305a04481ed9d3806ccfaa51bc.png)
By default, receiver value is always NULL.
I am trying to display all Messages where receiver is NULL.
But how?
Since this wont work.
Code
System.out.println("1. Read messages 2. Send message 0. Quit");
answer=reader.nextInt();
reader.nextLine();
if(answer==1)
{
try{
st = con.createStatement();
rs = st.executeQuery("SELECT Message FROM Messages WHERE Receiver = IS NULL");
while (rs.next()) {
System.out.println(rs.getString(1));
}
}catch(SQLException ex){
System.out.println(ex.toString());This is the error message
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IS NULL' at line 1
Now I know what you meant when you said you will lose something valuable.




![[Image: b0d566b8288ebf1a5714983ca99e8011.png]](https://gyazo.com/b0d566b8288ebf1a5714983ca99e8011.png)
![[Image: TEGE4Zx.png]](https://i.imgur.com/TEGE4Zx.png)