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

  • Home
  • SEARCH
  • 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 8646719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:53:10+00:00 2026-06-12T12:53:10+00:00

A complex one here? (for me at least). I have a table called tickets

  • 0

A complex one here? (for me at least). I have a table called tickets, with the id column being the unique key. I have another table called Labels, which doesn’t have a unique key (from the looks of it). In Tickets we store ticket information (messages, who made the ticket etc). We can add a label to a ticket when we create it so that we can search for tickets with those labels e.g. “review later”.

What I am trying to do, is a reverse type query e.g. show me all tickets that don’t have a specific label associated with it e.g. Don’t show me any tickets with “review later”. IF A TICKET DOESN’T HAVE ANY LABELS NOTHING IS PUT IN THE LABEL TABLE. I just can’t get any type of query I write, by hand or with a query builder to work.

I’m my image, you can see Tickets.id has 174 against it, which is also shown in Labels.ticket_id 174 with 2 x Labels set against it.

No matter what query, join, does, does not, etc I try, I either get back no results OR for some strange reason, I still get ticket 174 showing up.

Here is the most simple query I have tried… However, I think I’ve tried about 30 iterations by now from simple to very complex.

SELECT tickets.id
FROM
  tickets, labels_tickets
WHERE
  tickets.id <> labels_tickets.ticket_id
GROUP BY
  tickets.id

Can anyone suggest why this wouldn’t work or think of any method to build a statement that says:

Show me all tickets.id from tickets that don’t have the label “MyLabel” or doesn’t have a value at all in the Labels table.

Many 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-12T12:53:11+00:00Added an answer on June 12, 2026 at 12:53 pm
        SELECT tickets.id 
        FROM 
          tickets 
        WHERE 
          tickets.id NOT IN (SELECT ticket_id from labels_tickets where labels_tickets.label = 'out of hours' or labels_tickets.label = null) 
        GROUP BY 
          tickets.id 
    

    Try this I think it will work.

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

Sidebar

Related Questions

Hopefully this is less complex than I think. I have one table of companies,
I have a fairly complex model for one of my pages; it's made of
I have created one multiplication of complex function using prototype in java-script function ComplexNumber(real,imaginary)
I have two (unrelated) classes. The first one is Point: typedef std::complex<double> complex_number; class
I have a strange problem, at least one I've never come across. I have
I'm currently working on a database which is rather complex, at least for my
I have on one hand a complex, multi-threaded application, and on the other a
In a few days, I must make one complex commit, I'll try to explain
Please correct me if I am wrong, but is one complex query less expensive
I've been working on a complex app with one main dashboard. I don't particularly

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.