key on the month portion of a date field

2005-02-09 Thread Gabriel B.
Short Version: is there any way to make an index for a date field that appears in the WHERE as a MONTH() argument? I have a table with some hundreds of thousands of rows already, and now i have the need to show upcoming birthdays to some users. the query uses WHERE MONTH(birthday).. the `birthda

Re: key on the month portion of a date field

2005-02-09 Thread Gabriel B.
On Wed, 09 Feb 2005 17:24:10 +, love <[EMAIL PROTECTED]> wrote: > alter table table_name add index (birthday); But would that index improve this kind of query? the docs talk about only direct matchs, like "birthday < now()" or" birthday between x and y". They're all full date values. -- My

help with a mutuality check (good query exercise :)

2005-03-29 Thread Gabriel B.
I got stuck in this one, and i belive there's a solution, i just don't happen to see it. i have a table with conections between itens. something like +---+---+ | A | B | +---+---+ | 1 | 2 | | 1 | 3 | | 1 | 4 | | 2 | 1 | +---+---+ i'm trying to solve with one query a way to get all of the relation

subquery substitute in 4.0?

2005-04-04 Thread Gabriel B.
How can i do the following with 4.0? delete fom t1 where id in (select id from t1 where usr_id = 10 order by date_inserted limit 4,999) The ideia is to limit to 4 rows with the same usr_id value before i do an new insert with that user_id. Ending up with only 5 rows. I'm trying to not do a sele

alter only an enum label

2005-06-16 Thread Gabriel B.
If i have a table with about 800M records. and one of the fields is a enum("a", "b", "c") and i want to change it to enum("a","b","x") will it fall into some optimization and be instant? and what if previously i've never used the "c" value? isn't there any optimization for that? ...leaving "blank

Re: alter only an enum label

2005-06-16 Thread Gabriel B.
;,'b','c','x') > DEFAULT "a" NOT NULL > > then > > UPDATE tablename SET columname = 'x' WHERE columname = 'c' > > Then > > ALTER TABLE tablename CHANGE columnname columnname ENUM('a','b','x