Ooops, I forgot to notice that you required consequetive days.
This query works for me:
select T1.*, T2.*, count(T2.id) as c, concat(T2.id,T2.d) as x from table1
as T1, table2 as T2, table 2 as T3 where T1.id=T2.id and T2.id=T3.id and
T2.d>='2001-02-04' and T2.d<='2001-02-06' and T3.d>='2001-02-04' and
T3.d<='2001-02-06' group by x having c=3;
Uglier, but seems to work ok. Of course, you'll have to change the having
c=3 part to refect the number of days in the interval. Or maybe there is a
mysql date subtraction routine for that...
>>What I need is a query which will generate the
>>following result:
>>
>>+----+-------+------------+-------------+-----------+
>>| id | Item | date | no_of_items | table1_id |
>>+----+-------+------------+-------------+-----------+
>>| 1 | Item1 | 2001-02-04 | 3 | 1 |
>>| 1 | Item1 | 2001-02-05 | 2 | 1 |
>>| 1 | Item1 | 2001-02-06 | 2 | 1 |
>>+----+-------+------------+-------------+-----------+
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php