Re: problems with SELECT query results

Поиск
Список
Период
Сортировка
От PFC
Тема Re: problems with SELECT query results
Дата
Msg-id op.ts3jxcpgcigqcu@apollo13
обсуждение исходный текст
Ответ на problems with SELECT query results  (Joshua <joshua@joshuaneil.com>)
Ответы Re: problems with SELECT query results  (Joshua <joshua@joshuaneil.com>)
Список pgsql-general
> SELECT 'PV.LINEITEM:' || partnum || ',' || round(onhand) || ',' ||
> round(qm5) || ',' || round(lsm4) || ',' || ',' || ',' || round(onorder)
> || ',' || ',' || ',' || binone || ',' || ',' || round(backorderqty) ||
> ',' || ',' || round(onhold) || ',' || ',' || ',' || ',' || ',' || ',' ||
> ',' || round(qtyperjob) || ',' || round(ordermax) AS gmrim FROM slparts
> WHERE vendor LIKE 'CH%'

    You could select columns and build the string in your application ?

> The query does work and I am getting results from the database. There
> are values for all 'partnum' in the database, however, the query results
> include blank fields here and there in between the returned records. Why
> am I receiving blank fields for 'gmrim'???? This absolutely defies logic

    Because one of your fields is probably NULL, and NULL || anything stays
NULL.

    You have probably been misled to believe they are "blanks" because they
don't display as "NULL" but as "".
    I set psql to display NULL as NULL.

    If these columns can, must, or should not contain NULLs depends on your
application... it's for you to chose.
    Use COALESCE, add NOT NULL constraints, grab the columns and build the
string in your application, you chose.

В списке pgsql-general по дате отправления:

Предыдущее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: Postgres / Jaro Winkler fuzzy string matching
Следующее
От: ABHANG RANE
Дата:
Сообщение: opclass for real[]