如何在select语句之前写一个字符串?

时间:2016-04-22 20:55:47

标签: sql string select

我想要做的是编写一个字符串,这样我就可以格式化SQL语句的输出,并在实际输出我选择的行之前让它显示文本。

即。下一个时间表ID是[timesheetID]

我试图通过使用来做到这一点;

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

这显然不起作用,我该怎么做?

1 个答案:

答案 0 :(得分:3)

使用类似的东西

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

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