我的 sql 视图有以下字段:
name | description | date
我必须在其中查询max
和min
日期并将新视图打印为
status | name | description | starting
where in the status
field is a text field 将显示longest time
和shortest time
。这个字段是全新的,没有内置到任何表中,我将如何在视图中创建这个字段?
编辑:
我想在status
我的视图中添加额外的字段,所以制作一个额外的列。因此,我有
create or replace view one (name, description, starting) as
-- SQL STUFF HERE...
从这个视图中,我需要从中获取最大值和最小值并将这两个选择合并在一起,但添加一个额外的列来描述该行是否具有longest time
或shortest time
. 要得到
create or replace view two (status, name, description, starting) as
目前我已经写了
select name, longname, max(starting) from one
union
select name, longname, min(starting) from one;
这会打印出三列,但我需要添加额外的第四列status
,但我不知道该怎么做。