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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:34:24+00:00 2026-06-02T05:34:24+00:00

I came up with this query – how do I combine results from multiple

  • 0

I came up with this query – how do I combine results from multiple columns into 1 ?

select 
    R2.start_time,
    TIME_FORMAT(time(R2.start_time - time(10000)),
            '%H:%i:%s') as '-60min',
    TIME_FORMAT(time(R2.start_time - time(3000)),
            '%H:%i:%s') as '-30min',
    TIME_FORMAT(time(R2.start_time + time(10000)) - time(3000),
            '%H:%i:%s') as 30min,
    TIME_FORMAT(time(R2.start_time + time(10000)),
            '%H:%i:%s') as 60min
from
    (select 
        rooms.id, rooms.number, rooms.building, rooms.capacity
    from
        rooms) R1,
    (select 
        exam_schedules.room_id,
            exam_schedules.day,
            exam_schedules.start_time,
            exam_schedules.end_time
    from
        exam_schedules) R2
where
    R2.room_id = R1.id and R2.day = 'tuesday' AND R1.number = 006
group by 1

this is my result:(1 row)

12:30:00    11:30:00    12:00:00    13:00:00    13:30:00

should be (5 rows):

12:30:00
11:30:00
12:00:00
13:00:00
13:30:00
  • 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-02T05:34:25+00:00Added an answer on June 2, 2026 at 5:34 am

    Aside from making use of a union statement here’s an example of something you could do:

    declare @dates table ( start_time datetime )
    
    insert into @dates 
    select GETDATE()
    
    declare @offsets table ( offset int, seq int)
    
    insert into @values
    select 0, 1
    union select -60, 2
    union select -30, 3
    union select 30, 4
    union select 60, 5
    
    select * from @dates
    
    select 
        dateadd(minute, o.offset, r2.start_time) dt
    from
        @dates r2, @offsets o
    order by o.seq
    

    Cant really test your query since I don’t have your time functions, but you’d end up with something like this:

    declare @offsets table ( offset int, seq int)
    
    insert into @offsets
    select 0, 1
    union select -60, 2
    union select -30, 3
    union select 30, 4
    union select 60, 5
    
    select 
        dateadd(minute, o.offset, t.start_time) dt
    from
    (
    select 
        R2.start_time as start_time
    from
        (select 
            rooms.id, rooms.number, rooms.building, rooms.capacity
        from
            rooms) R1,
        (select 
            exam_schedules.room_id,
                exam_schedules.day,
                exam_schedules.start_time,
                exam_schedules.end_time
        from
            exam_schedules) R2
    where
        R2.room_id = R1.id and R2.day = 'tuesday' AND R1.number = 006
    group by 1
    ) t
    , @offsets o
    order by o.seq
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While debugging into some Oracle code, I came across this query: SELECT TPM_TASK.TASKID FROM
I have some data, yes, data. This data came from a MySQL query and
While researching Oracle Analytics, I came across this query: select an_id, a_date, min(a_date) over
It could be a stupid query, but i came across of this query multiple
I came across a query today, SELECT col1,'yes' as col2 FROM myTable WHERE col2=TRUE
i have this query that works fine SELECT t.username FROM users t LEFT JOIN
This query originally came from a VB6 program accessing MS Access tables which are
I am trying to write a query that would select data from multiple lines
I came up with the below query: SELECT ROOMNO,BUILDINGNO FROM MRM_ROOM_DETAILS WHERE ROOMID IN
I'm running a query which looks like this SELECT parent.field, child.field FROM parent JOIN

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.