user6009023
user6009023

Reputation:

How to I write a string before the select statement?

What I want to do is write a string so I can format the output of the SQL statement and have it display text before I actually output the rows I have selected.

i.e. The next timesheet ID is [timesheetID]

I'm trying to do it by using;

||'The next timesheet ID is'|| select max(timesheet_id) + 1 from funtom_timesheet;

Which obviously isn't working, how do I do this?

Upvotes: 0

Views: 59

Answers (1)

cableload
cableload

Reputation: 4385

Use something like this

Select 'The next timesheet ID is ' || max(timesheet_id) + 1 from funtom_timesheet;

or

select concat('The next timesheet ID is ',max(timesheet_id)+1) from futom_timesheet;

Upvotes: 3

Related Questions