SQL condition null

SQL condition null

  
Hi

I was going to do something like following with QUERY

SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NULL

I added a condition, "Address IS NULL". It won't work.

Is there anyother way to get around?
Hello Richard,

The Address is a foreign key or only text?

If is only text you need to put  Where Address = '  '

Regards
Hugo Pinheiro
Hi Richard,

As Hugo said, if it's text, it should be "". If it's an identifier, and null isn't working, try = 0.

Regards,

Paulo Tavares
Thanks for replying.

address = ""  work.

address <> ""   doesn't work.

Here is my challenge, I have a check box on the user interface ("don't show empty address reocrds").

When it is checked, then don't show the records with empty address

When it is not checked, display all records includes empty address

What is the way to set this up?
Hello Richard,

Do something like this:
   - Checked (will be the variable of your check box);
   - So on your condition you need to put: "(checked = True and address = "" or checked = False)";
   - This will work for your case.

I hope thats help

Regards
Hugo Pinheiro
Hi Hugo,

Thanks for the syntax. It works perfectly.

For my future reference, with that syntax, is it describted in any help documents?
Hi Richard,

The syntax is pure SQL condition syntax, and boolean logic. You can learn more about it here - even though it's Oracle, most of it should work.

I hope this helps you get the hang of it easier :)

Regards,

Paulo Tavares