SELECT * WHERE 'this-field' has a value?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
WithHisStripes
Forum Contributor
Posts: 131
Joined: Tue Sep 13, 2005 7:48 pm

SELECT * WHERE 'this-field' has a value?

Post by WithHisStripes »

Heya - I need to select all the records from a table that have something, anything, entered in it's field. But I'm not sure how to do this, can someone help? Thanks!
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: SELECT * WHERE 'this-field' has a value?

Post by jayshields »

If you're using NULLs you can do it like this:

Code: Select all

SELECT * FROM `table` WHERE `field` NOT NULL
WithHisStripes
Forum Contributor
Posts: 131
Joined: Tue Sep 13, 2005 7:48 pm

Re: SELECT * WHERE 'this-field' has a value?

Post by WithHisStripes »

Awesome thanks!
Post Reply