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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:28:02+00:00 2026-06-05T17:28:02+00:00

If the query below returns a ‘template’ id for any template assigned to a

  • 0

If the query below returns a ‘template’ id for any template assigned to a report that has not yet started…

How can I also say (AND for each one of these template id’s – this template id can’t be on any other report that has already started).

Or, I mean I’m trying to finish out the query below so it says “Give me the id’s of all templates where the template is not in use by any report that has started”. Like if for each t.id I looped through the table making sure that there were no other reports with the template_id (t.id) that have already started.

SELECT DISTINCT t.id, 
FROM templates t
LEFT OUTER JOIN reports r ON r.template_id = t.id
WHERE r.start_time >=  UTC_TIMESTAMP()

Thanks!

  • 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-05T17:28:04+00:00Added an answer on June 5, 2026 at 5:28 pm

    You can use subquery like

    SELECT DISTINCT t.id, 
    FROM templates t
    LEFT OUTER JOIN reports r ON r.template_id = t.id
    WHERE r.start_time >=  UTC_TIMESTAMP() and t.id not in (select CONCAT_WS(',',tid) where report started) 
    

    i am not completing the subquery as i dont know exact table structure. so complete the where clause accordingly

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Sql-Server, and I have the below query which returns all columns that
I have a query that returns a result set similar to the one below:
I tried this query below but it still returns days that had -1 values.
The query below returns rows that have both loginid and ip2 in the bumps
I have a problem with the SQL statement detailed below. The query returns the
Why the two query below return duplicate member_id and not the third? I need
Why does the MySQL query below give error 1066 (Not unique table/alias: 'customer') ?
I've got a query below. I want to add a condition that if the
I thought that the query below would naturally do what I explain, but apparently
in my sql query - one line as listen below returns me a varchar

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.