[rt-users] Query in script not working

Mathew Snyder mathew.snyder at gmail.com
Mon Feb 25 10:13:26 EST 2008


Printing $yesterday yields 2008-02-24.

$tix->BuildSelectQuery gives
SELECT main.* FROM Tickets main  WHERE (main.Status != 'deleted') AND ( (
main.Queue = '1' OR main.Queue = '15' )  AND  ( main.LastUpdated >= '2008-02-24
05:00:00' AND main.LastUpdated <= '2008-02-25 05:00:00' ) ) AND (main.Type =
'ticket') AND (main.EffectiveId = main.id)

One thing that stands out is that it is placing the limits at 05:00:00.  I'd
prefer that it find things which are between 00:00:00 and 23:59:00 of the given
day.  Also, it is looking for tickets which were last updated <= today and >=
yesterday.  I don't want anything from today so I need to eliminate the <= today
portion.


Stephen Turner wrote:
> Quoting Mathew Snyder <mathew.snyder at gmail.com>:
> 
>> I'm trying to get all of the tickets which, for any given day, were
>> LastUpdated
>> 'yesterday'.  When I do a search within RT using " LastUpdated =
>> '2008-02-24'
>> AND  (  Queue = 'CustomerCare' OR Queue = 'TechOps' )" I'm shown 8
>> tickets.
>> However, when I run the following script I get nothing.
>>
>>
> 
> Mathew,
> 
> What do you get if you put 'print $yesterday' in your script? Also,
> printing
> $tix->BuildSelectQuery (after the FromSQL statement) will show you the
> actual
> sql statement being used, and might be helpful.
> 
> Steve

-- 
Keep up with me and what I'm up to: http://theillien.blogspot.com



More information about the rt-users mailing list