Loans - Best credit cards - boy baby names - Bad Credit Mortgages - 0% credit cards

PDA

View Full Version : MYSQL field is empty?


Weirfire
Sep 19th 2005, 9:28 am
Is it possible to run a query to return all results where a certain field is not empty?

JoeO
Sep 19th 2005, 9:37 am
sure !=NULL or !="" ... depending on how its empty

Weirfire
Sep 19th 2005, 9:39 am
I just read on another forum this solution

SELECT * FROM table_name WHERE column_name > '';

for those who come across this thread in the future.


Thanks JoeO :)

digitalpoint
Sep 19th 2005, 9:45 am
ISNULL([columnname]) is a good operator in MySQL as well.

Weirfire
Sep 19th 2005, 9:48 am
ISNULL([columnname]) is a good operator in MySQL as well.

So to use that for my problem could you put

SELECT * FROM table_name WHERE !(ISNULL([columnname]));

digitalpoint
Sep 19th 2005, 10:02 am
Probably just easier to do this:

SELECT * FROM table_name WHERE NOT ISNULL([columnname]);

Weirfire
Sep 19th 2005, 10:33 am
Cheers Shawn :)