select
adm_lu_code,
adm_lu_description,
upper(substr(adm_lu_code, 1, 1)) as first_letter
From
csq_admin_lookup
where
adm_lu_system = 'CRM'
and adm_lu_type = 'GLOSSARY'
order by
adm_lu_code
Is there any way I can get the "first_letter" field to appear in the query result set, with nulls as the other two values, even if there are items in the data base that don't start with this letter? I want the output to look like this:
Code Description first_letter
null null A
null null B
DE Germany D
FR France F
USA United States U
Of course there would be other values in the database. What I want to ensure is that the null values show up in the resultset if there is no such code that starts with this letter. This way I will be able to put the letter as a header on the report with nothing beneath it, denoting this group as having no values.
I know I can do this with another table named "Alphabet", and do a left join on this table, however, I'd like to do this another way, without building a new table.
Thanks,![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Peter
adm_lu_code,
adm_lu_description,
upper(substr(adm_lu_code, 1, 1)) as first_letter
From
csq_admin_lookup
where
adm_lu_system = 'CRM'
and adm_lu_type = 'GLOSSARY'
order by
adm_lu_code
Is there any way I can get the "first_letter" field to appear in the query result set, with nulls as the other two values, even if there are items in the data base that don't start with this letter? I want the output to look like this:
Code Description first_letter
null null A
null null B
DE Germany D
FR France F
USA United States U
Of course there would be other values in the database. What I want to ensure is that the null values show up in the resultset if there is no such code that starts with this letter. This way I will be able to put the letter as a header on the report with nothing beneath it, denoting this group as having no values.
I know I can do this with another table named "Alphabet", and do a left join on this table, however, I'd like to do this another way, without building a new table.
Thanks,
![[smile] [smile] [smile]](/data/assets/smilies/smile.gif)
Peter