I have a simple query, (part of a union).
calendar is a table of only dates, `date` as PK.
sales has a multi-col index on (date, uid).

(select calendar.date as date,
       time_format(time(sales.date),'%H:%i') as time,
    from calendar
    left join sales
       on date(sales.date) = calendar.date
       and sales.uid = 'george'
    where calendar.date between '2005-08-01' and '2005-08-14')

First, I don't quite understand joins(!) on constants (sales.uid = 'george').
Is this proper, or should uid be included in where clause?

Second, explain shows no possible keys for sales.

id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY calendar range PRIMARY PRIMARY 3 NULL 11 Using where; Using index
1       PRIMARY sales   ALL     NULL    NULL    NULL    NULL    23

Some versions of my query showed possible_keys, but I can't seem to
find what I did and I'm frustrated.  What am I doing wrong here?

Thanks.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to