Simple SQL question I think.
I'm trying to return the buyer's name for each item in the ITEM table. The buyer's name comes from the PERS table. Some items have a buyer and some don't. Here are the column names:
pers.first_name
pers.last_name
I want to return a result like this:
Doe, John
This SQL works:
SELECT pers.last_name || ', ' || pers.first_name FROM ...
However, sometimes there is no buyer; then it returns only a comma (,). I would like to lose the comma if the name column(s) are null.
How is this done?
Thanks in advance!
-Striker
I'm trying to return the buyer's name for each item in the ITEM table. The buyer's name comes from the PERS table. Some items have a buyer and some don't. Here are the column names:
pers.first_name
pers.last_name
I want to return a result like this:
Doe, John
This SQL works:
SELECT pers.last_name || ', ' || pers.first_name FROM ...
However, sometimes there is no buyer; then it returns only a comma (,). I would like to lose the comma if the name column(s) are null.
How is this done?
Thanks in advance!
-Striker