Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:23:12+00:00 2026-06-02T01:23:12+00:00

I have the following fields for my sql view: name | description | date

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:23:14+00:00Added an answer on June 2, 2026 at 1:23 am

    Just use a simple string:

    select 'longest time' AS status, name, longname, max(starting) from one
    union
    select 'shortest time' AS status, name, longname, min(starting) from one; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following databases: test table1 fields: id, password, name, lastname test2 table2 fields:
I have a table called Employee with the following fields: EmpID Salary Name I
I have a a gridpanel that has the following fields: Name ID Address Home_Phone
I have the following sql query that fetches images from an establishment table. The
I have 4 tables Titles having the following fields, id (PK), Name, AuthorId(FK) &
I have the following SQL Expression Field in my Crystal Report 11.5 {fn CONCAT({fn
I have the following fields: Inventory control (16 byte record) Product ID code (int
If I have the following fields in a table called DailyLeaveLedger LeaveDate LeaveType AmountPaid
I have two tables in a SQLite DB, and both have the following fields:
Good day, If I have for example the documents which have the following fields

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.