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 7875005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:54:41+00:00 2026-06-03T02:54:41+00:00

My database structure is as follows: I have scheduletimes which have a classtime. Each

  • 0

My database structure is as follows:

I have scheduletimes which have a classtime. Each scheduletime has a tclass associated with it that has a duration. I would normally use a join of some sort to grab the duration, however, since I am using the overlaps comparison in postgres I am not sure if this is possible. The query would look something like this…

Select (scheduletimes.classtime, scheduletimes.classtime + interval 
(select duration from tclasses where tclass.id = scheduletimes.tclass_id) minutes) OVERLAPS 
(06:50:00, 07:20:00) from schedules where
day = 1 and
schedule_id = 14;
  • 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-03T02:54:41+00:00Added an answer on June 3, 2026 at 2:54 am

    You can use a subquery, but in your example you are mixing the literal format with a value from a column, which won’t work. And generally it is better to JOIN rather than to use a subquery, so you might want something like this:

    SELECT
        scheduletimes.*,
        (scheduletimes.classtime, scheduletimes.classtime
             + (interval '1 minute' * tclasses.duration))
           OVERLAPS (time '06:50:00', time '07:20:00')
      FROM scheduletimes
      JOIN tclasses ON tclasses.id = scheduletimes.tclass_id
      WHERE day = 1
        AND schedule_id = 14;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table in database which has following structure(data) : +--------------------------+ Organization +--------------------------+
I have a database which has multiple nested associates. Basically, the structure is as
I have got a table structure which is as follows: `CREATE TABLE "pages" (
I have a staging database which stores the GEO location as the following structure
I have the following database structure: Notice that the field fk_parent_group_id can either be
Hi all i have my database structure as follows Field Type FileHeader longblob BatchHeader
I have database table whose structure is as follows: id int name varchar(20) dob
I have a Table1 with structure as follows: Database name value SYSTEM SCOTT 2
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
I have such database structure (1 - one, 0 - many) Product 1->0 Orders

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.