I have the following fields for my sql view:
name | description | date
where I have to query for the max and min dates and print the new view as
status | name | description | starting
where in the status field is a text field will show longest time and shortest time. This field is completely new, and isn’t built into any of the tables, how would I go in creating this field in the view?
EDIT:
I want to add the extra field status to my view, so make an extra column. As such, I have
create or replace view one (name, description, starting) as
-- SQL STUFF HERE...
from this view, I need to grab the max and min from it and union those two selections together, but add an extra column which describes whether that row has the longest time or the shortest time. To get
create or replace view two (status, name, description, starting) as
at the moment I’ve written up
select name, longname, max(starting) from one
union
select name, longname, min(starting) from one;
and this prints out the three columns, but I need to add the extra fourth column status but I don’t know how to do this.
Just use a simple string: