0

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.

1 Answer 1

1

You can try the below -

select 'all' as col1
union all
select distinct col1 from tab1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.