This is a discussion on SELECT RECORD WHERE COLUMN IS NULL within the MySQL Database forums, part of the Database Forums category; I have a column defined as VARCHAR 40 NULL I trying to select records where this column is NULL (or ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have a column defined as VARCHAR 40 NULL
I trying to select records where this column is NULL (or no active_code) using WHERE relationships.befriender_id = 22 AND relationships.active_code = NULL but I don' t get it WHERE relationships.befriender_id = 22 works fine I am wrong but why ? thanks fyl joss |
|
|||
|
On Feb 28, 10:37 pm, Josselin <josse...@wanadoo.fr> wrote:
> I have a column defined as VARCHAR 40 NULL > > I trying to select records where this column is NULL (or no active_code) using > > WHERE relationships.befriender_id = 22 AND relationships.active_code = NULL > > but I don' t get it > > WHERE relationships.befriender_id = 22 works fine > > I am wrong but why ? > > thanks fyl > > joss WHERE field IS NULL or WHERE ISNULL(field) |
|
|||
|
On Wed, 28 Feb 2007 23:37:36 +0100, Josselin <josselin@wanadoo.fr>
wrote: >I have a column defined as VARCHAR 40 NULL > >I trying to select records where this column is NULL (or no active_code) using > >WHERE relationships.befriender_id = 22 AND relationships.active_code = NULL > >but I don' t get it > >WHERE relationships.befriender_id = 22 works fine > >I am wrong but why ? > >thanks fyl > >joss Try is NULL vs. = NULL |
|
|||
|
strawberry wrote:
> On Feb 28, 10:37 pm, Josselin <josse...@wanadoo.fr> wrote: > >>I have a column defined as VARCHAR 40 NULL >> >>I trying to select records where this column is NULL (or no active_code) using >> >>WHERE relationships.befriender_id = 22 AND relationships.active_code = NULL >> >>but I don' t get it >> >>WHERE relationships.befriender_id = 22 works fine >> >>I am wrong but why ? >> >>thanks fyl >> >>joss > > > WHERE field IS NULL > or > WHERE ISNULL(field) > The reason is the fact that NULL does not equal anything - in fact NULL != NULL so you must use the database syntax previously stated. M. |
|
|||
|
On 2007-02-28 23:37:36 +0100, Josselin <josselin@wanadoo.fr> said:
> I have a column defined as VARCHAR 40 NULL > > I trying to select records where this column is NULL (or no active_code) using > > WHERE relationships.befriender_id = 22 AND relationships.active_code = NULL > > but I don' t get it > > WHERE relationships.befriender_id = 22 works fine > > I am wrong but why ? > > thanks fyl > > joss thanks to all of u... got it sosimple :-() |