[rt-users] SQL Query Help

Mathew Snyder theillien at yahoo.com
Thu Mar 22 02:35:58 EDT 2007


I'm trying to write a query the the FromSQL method.  I need to create an object
contains tickets in our CustomerCare queue and that have either been worked on
or resolved in the last week (which will be based on the date the script is run,
not the last week from now).

This is what I have so far
$tix->FromSQL('Queue = "CustomerCare" AND Status = "resolved" OR Status = "open"');

I'm thinking I need to add something like "AND (Created > $startDate AND
LastUpdated < $endDate) OR Resoved > $startDate".  Basically, I don't really
care when it was created.  I just need the transactions that were added between
a start date and an end date.  That makes me think the above snippets are both
wrong.

I have been trying to use the Query Builder to get this accomplished but it
doesn't seem to support both AND and OR requests in the same query.  Changing
the aggregator changes it for the entire query, not just one line.  Selecting
the Aggregator prior to adding a new criteria does the same thing.

Can anyone help me out with this?

Mathew



More information about the rt-users mailing list