Обсуждение: Query combining columns

Поиск
Список
Период
Сортировка

Query combining columns

От
phil campaigne
Дата:
    Hi All,
Can I combine 2 columns as a single column in a select statement?
i.e.  select value_1, value_2, (value_2 + value_2) from table;

If so, in java how do I get the value of the combined column out of the
result object?
I tried
 checkSum = result.getInt("(value_1 + value2)");
and
checkSum=result.getInt(3);
Thanks,
Phil


Re: Query combining columns

От
Nabil Sayegh
Дата:
Am Mon, 2003-07-07 um 21.04 schrieb phil campaigne:
>     Hi All,
> Can I combine 2 columns as a single column in a select statement?
> i.e.  select value_1, value_2, (value_2 + value_2) from table;

Concatenating 2 Strings is done with ||
SELECT 'foo' || ' bar';
'foo bar'

The result is simply 1 string, ie. you can handle it like any other
column.

HTH
--
 e-Trolley Sayegh & John, Nabil Sayegh
 Tel.: 0700 etrolley /// 0700 38765539
 Fax.: +49 69 8299381-8
 PGP : http://www.e-trolley.de