Still learning... I bumped into this and I can't tell what's wrong, I am pretty sure I am goofing around, if one can help, thanx in advance.
create table t (a text, b text, c text, d text, e text);
insert into t (a,b,c,d,e) values (22,22,22,22,22);
insert into t (a,b,c,d,e) values (333,333,333,333,333);
select
max(length('a'),length(a)),
max(length('b'),length(b)),
max(length('c'),length(c))
from t;
max(length max(length max(length
---------- ---------- ----------
2 2 2
3 3 3
Why is there 2 lines printed since all 'cols' are aggregate ?
Removing some element in the quere reduce the number of line like this
select
max(length('a'),length(a)),
max(length('b'),length(b)),
max(length(c))
from t;
max(length max(length max(length
---------- ---------- ----------
3 3 3
My intent is to discover the max length between a column values and column name, I fear I misuse the max() here
Guru meditation...
Cheers, Phi
====================
I guess I should use max() like this.
select
max(length('a'),max(length(a))),
max(length('b'),max(length(b))),
max(length('cccc'),max(length(c)))
from t;
max(length max(length max(length
---------- ---------- ----------
3 3 4
Aucun commentaire:
Enregistrer un commentaire