Colton A Smith <smith@cs.utk.edu> schrieb:
> Hi:
>
> Let's say I have a table with a column of one-dimensional arrays. What
> exactly is returned when the database is queried for a maximum from that
> particular column? The array was the greatest average value? Let's say
What du you expect?
test=# select * from foo;id | bar
----+--------- 1 | {1,2,3} 2 | {2,2,2} 3 | {3,2,1}
(3 rows)
Which row is the max()?
test=# select max(bar) from foo; max
---------{3,2,1}
(1 row)
It compares the first value in every array. If you wish to compare the
array depending on a other column, you can use somethink like
test=# select id, bar from foo order by bar ;id | bar
----+--------- 1 | {1,2,3} 2 | {2,2,2} 3 | {3,2,1}
(3 rows)
test=# select id, bar from foo order by bar[3] ;id | bar
----+--------- 3 | {3,2,1} 2 | {2,2,2} 1 | {1,2,3}
(3 rows)
> I have a table with a column of two-dimensional arrays. What then?
The same.
HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°