Hi guys. Just struggling on wrapping my head around a MySQL statement I need for unique records.
I have a table that will be queried by a date range. IE-> return records between 2011-07-20 and 2011-07-31. Now imagine these records have a field called _ID
What complicates it is that it must ignore records that have a same _ID outside of the date range.
EG. Running a query with the above dates, and it returns 10 records with _ID 1-10. But three of these records, lets say 6,7,8 occur before the date range. The query has to ignore these records with _ID 6,7,8.
The PHP programmer in me see's the easy solution of just running two queries and looping on an exclude basis, but this table will get rather big fast, so would prefer as little mysql overhead as possible....
I have a table that will be queried by a date range. IE-> return records between 2011-07-20 and 2011-07-31. Now imagine these records have a field called _ID
What complicates it is that it must ignore records that have a same _ID outside of the date range.
EG. Running a query with the above dates, and it returns 10 records with _ID 1-10. But three of these records, lets say 6,7,8 occur before the date range. The query has to ignore these records with _ID 6,7,8.
The PHP programmer in me see's the easy solution of just running two queries and looping on an exclude basis, but this table will get rather big fast, so would prefer as little mysql overhead as possible....