[rt-users] Searching for tickets with null date

Schultz, Eric ESchultz at corp.untd.com
Thu Apr 13 12:59:24 EDT 2006


> I'm trying to do a search in the Query Builder interface for tickets 
> with null Told (Last Contacted) date - I can't figure out how to do 
> it. Does anyone know how?

Here's what I suggest, since this seems to be a problem with RT not
knowing how to query for null dates.

1. mysql> alter table Tickets change Told Told datetime not null default
'0000-00-00 00:00:00';
2. mysql> update Tickets set Told='0000-00-00 00:00:00' where Told is
null;
3. TicketSQL: Told < '1980-01-01 00:00:00'

Or you can use some other really old date for 3.  But now, you're
dealing with valid datetime values rather than NULL, so the query with
the comparison operator will work.  Also note, this will not affect how
"Last Contact" is displayed in the ticket display screen (it will still
say "Not set").  Funny thing, however, is that this TicketSQL:

Told = '0000-00-00 00:00:00'

will not work.  Probably due to a problem someone else posted in the
list in the past day, about there being some weird off by one date
calculation/string conversion or something.

Eric Schultz
United Online



More information about the rt-users mailing list