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
> > 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
> > 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
> 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
> 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
> 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
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