PDA

View Full Version : ExtJS Query Problem



Arcadius
26 Jan 2010, 2:11 PM
Hey everyone. I am having some difficulties with a query of mine. I realize it may not have much to do with ExtJS, but I was hoping someone may have an idea that may help me.

I've built a simple grid where a user inputs text (all or part of an email address). The user selects a start and end date as well (to make the query smaller).

My problem is this, I select a date range, say Jan 20th til Jan 25th, and it will return 4 results, which is fine. But if I move the start date back two days, so it's from Jan 18th to Jan 25th, it only shows one result, which is the result from Jan 18th. The rest from the 20th to 24th seem to disappear and I have no idea why.

I have seen the query that is being ran and it looks fine, so I am realllly confused as to what is happening. Anyone that has any ideas, please feel free to respond.

Here are the queries and responses.

QUERY 1: (Jan 18-26) returns:
SELECT l.Title, l.Description, l.ListID, q.SentDate, qe.Email
FROM Lists AS l, Queue AS q JOIN QueueEmails AS qe ON qe.QueueID = q.QueueID
AND q.Type = 'live'
AND q.DataType = 'List'
AND q.SentDate > 1263790800
AND q.SentDate < 1264482000
WHERE q.ListID = l.ListID
AND qe.Email LIKE '%fabiacarol%' UNION SELECT qry.Title, qry.Title as Description, qry.QueryID as ListID, q.SentDate, qe.Email
FROM Queries AS qry, Queue AS q JOIN QueueEmails AS qe ON qe.QueueID = q.QueueID
AND q.Type = 'live'
AND q.DataType = 'Query'
AND q.SentDate > 1263790800
AND q.SentDate < 1264482000
WHERE q.ListID = qry.QueryID
AND qe.Email LIKE '%fabiacarol%'
ORDER BY Title ASC

With Response:
({"total":"1","results":[{"Title":"TG - All Players with any Betting subscriber options selected","Description":"TG - All Players with any Betting subscriber options selected","ListID":"226","SentDate":"1263830401","Email":"[email protected] ([email protected])"}]})



QUERY 2: (Jan 20-26) returns:
SELECT l.Title, l.Description, l.ListID, q.SentDate, qe.Email
FROM Lists AS l, Queue AS q JOIN QueueEmails AS qe ON qe.QueueID = q.QueueID
AND q.Type = 'live'
AND q.DataType = 'List' AND q.SentDate > 1263963600
AND q.SentDate < 1264482000
WHERE q.ListID = l.ListID
AND qe.Email LIKE '%fabiacarol%'
UNION SELECT qry.Title, qry.Title as Description, qry.QueryID as ListID, q.SentDate, qe.Email
FROM Queries AS qry, Queue AS q JOIN QueueEmails AS qe ON qe.QueueID = q.QueueID
AND q.Type = 'live'
AND q.DataType = 'Query'
AND q.SentDate > 1263963600
AND q.SentDate < 1264482000
WHERE q.ListID = qry.QueryID
AND qe.Email LIKE '%fabiacarol%'
ORDER BY Title ASC

With Response:
({"total":"5","results":[{"Title":"TG - All Active Poker Players","Description":"TG - All Active Poker Players","ListID":"210","SentDate":"1264323601","Email":"[email protected] ([email protected])"},{"Title":"TG - All Players Except Russian speakers and Germans","Description":"TG - All Players Except Russian speakers and Germans","ListID":"265","SentDate":"1264204801","Email":"[email protected] ([email protected])"},{"Title":"TG - Lucky Dollar - All level 2 players","Description":"TG - Lucky Dollar - All level 2 players","ListID":"254","SentDate":"1264161601","Email":"[email protected] ([email protected])"},{"Title":"TG - Players (Selected News, or Tourney Info, or Casino Info, or Poker Promos, or Special Bets)","Description":"TG - Players (Selected News, or Tourney Info, or Casino Info, or Poker Promos, or Special Bets)","ListID":"261","SentDate":"1264086001","Email":"[email protected] ([email protected])"},{"Title":"TG NFL Betting List","Description":"TG NFL Bettors","ListID":"264","SentDate":"1264244401","Email":"[email protected] ([email protected])"}]})

So I was expecting the first queries response to have all the data from the second query and the one piece of data that does show up from that query itself.