I have to write a query in Teradata
one of my table is empty.
select count(*) as counts
,'sourcename' as src_name
from table1
if the table is empty it returns zero rows.
I want my output to give me
0 sourcename
is there any function which will force the values 0 and sourcename.I tried zeroifnull that didnt work.can any one please help me with syntax?
Teradata syntax
Moderators: chulett, rschirm, roy
Teradata syntax
Last edited by Hope on Thu Jul 26, 2007 9:15 am, edited 1 time in total.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Does Teradata allow for SELECT in the SELECT clause?
Code: Select all
SELECT (SELECT COUNT(*) FROM table) AS COUNTS, 'sourcename' FROM table;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 299
- Joined: Wed Nov 13, 2002 5:38 pm
- Location: USA