user3642360
user3642360

Reputation: 792

how to add external string to the output of a query

I want to add a string to the output of a query, for example: my table tab1 has a column, named col1. col1 has 5 distinct values: d1, d2, d3, d4, d5.

with the following query I got the distinct values:

select distinct col1 from tab1

I want to add 'all' to the output of this query. So the expected output will be as follows:

col1
all
d1
d2
d3
d4
d5

Any help will be highly appreciated. TIA.

Upvotes: 0

Views: 107

Answers (1)

Fahmi
Fahmi

Reputation: 37483

You can try the below -

select 'all' as col1
union all
select distinct col1 from tab1

Upvotes: 1

Related Questions