User-variables weirdness... initialized or not?

2002-03-07 Thread Stig Nørgaard Jepsen
You have this table: id data 3 2 2 1 1 3 This query: SELECT @var, data, @var:=data+(IFNULL(@var,0)) FROM table What would result would you expect the first time you execute the query? I would expect this: NULL, 2, 2 2, 1, 3 3, 3, 6 But this is what you get the first time: NULL, 2, 2 NULL, 1, 1

Re: Is this possible with MySQL?

2001-12-27 Thread Stig Nørgaard Jepsen
> > I would emagine that only one 'left join' takes less processing power? > > Yes, but I don't think there is very much extra processing time involved > using one more join in most cases, as long as the join is indexed and the > index blocks involved are cached, or if the amount of data is reaso

Re: Is this possible with MySQL?

2001-12-23 Thread Stig Nørgaard Jepsen
> > Ok, I will, but I CC it to the mailinglist, maybe others have interest > > and/or comments. Besides, I think I may have found a bug... > > Yes, of course my fault not to post directly to the list :) > > I have another problem with this query. > If the textvalue field is the text type, then i

Re: Is this possible with MySQL?

2001-12-23 Thread Stig Nørgaard Jepsen
> select distinct > t1.textkey, > if(t2.textid,t2.languageid,t3.languageid) as languageid, > if(t2.textid,t2.textid,t3.textid) as textid, > if(t2.textid,t2.textvalue,t3.textvalue) as textvalue > from texts t1 > left join texts t2 on > t2.textkey=t1.textkey and > t2.languageid='da' > le

Re: Is this possible with MySQL?

2001-12-23 Thread Stig Nørgaard Jepsen
> Ok, I will, but I CC it to the mailinglist, maybe others have interest > and/or comments. Besides, I think I may have found a bug... Yes, of course my fault not to post directly to the list :) I have another problem with this query. If the textvalue field is the text type, then i get this erro

Re: Is this possible with MySQL?

2001-12-22 Thread Stig Nørgaard Jepsen
> You may try this and see if it works (didn't test it, just jotted it down > here): > > select t1.textid, t1.textid, t1.textvalue I just don't understand why you did this? Why select t1.textid twice? > from texts as t1, texts as t2 Again I don't understand this... Wouldn't t1 and t2 be the s

Is this possible with MySQL?

2001-12-21 Thread Stig Nørgaard Jepsen
I have this table: CREATE TABLE texts ( textid mediumint(9) NOT NULL auto_increment, languageid char(2) NOT NULL default 'da', textkey varchar(32) NOT NULL default '', textvalue text NOT NULL, PRIMARY KEY (textid), ) It could contain these data: (textid,languageid,textkey,textvalue) 1