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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:33:24+00:00 2026-05-23T11:33:24+00:00

Sorry for the confusing question, I will try to clarify. I have an SQL

  • 0

Sorry for the confusing question, I will try to clarify.

I have an SQL database ( that I did not create ) that I would like to write a query for. I know very little about SQL, so it is hard for me to even know what to search for to see if this question has already been asked, so sorry if it has. It should be an easy solution for those in the know.

The query I need is for a search I would like to perform on an existing data management system. I want to return all the documents that a given user has NOT signed-off on, as indicated by rows in a signoffs_table. The data is stored similarly to as follows: (this is actually a simplification of the actual schema and hides several LEFT JOINS and columns)

signoffs_table:
| id | user_id | document_id | signers_list |

The naive solution I had was to do something like the following:

SELECT document_id from signoffs_table WHERE (user_id <> $BobsID) AND signers_list LIKE "%Bob%";

This works if ONLY Bob signs the document. The problem is that if Bob and Mary have signed the document then the table looks like this:

signoffs_table:
-----------------------------------------------
| id | user_id | document_id | signers_list   |
-----------------------------------------------
| 1  | 10      | 100         | "Bob,Mary,Jim" |
| 2  | 20      | 100         | "Bob,Mary,Jim" |
-----------------------------------------------

(assume Bob's ID = 10 and mary's ID = 20). 

and then when I do the query then I get back document_id 100 (in row #2) because there is a row that Bob should have signed, but did not.

Is what I am trying to do possible with the given database structure? I can provide more details if needed. I am not sure how much details are needed.

  • 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-05-23T11:33:24+00:00Added an answer on May 23, 2026 at 11:33 am

    I guess this query is what you mean:

    SELECT document_id FROM signoffs_table AS t1
    WHERE signers_list LIKE "%Bob%"
    AND NOT EXISTS (
        SELECT 1 FROM signoffs_table AS t2
        WHERE (t2.user_id = $BobsID) AND t2.document_id = t1.document_id )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry the title isn't more help. I have a database of media-file URLs that
Sorry if that question is confusing, I'm self-learning javascript. I'm dynamically generating image thumbnails
Before answering this question, understand that I am not asking how to create my
Sorry if the question title is confusing. Let me explain further. I am building
Sorry for the basic question - I'm a .NET developer and don't have much
Sorry for this not being a real question, but Sometime back i remember seeing
Sorry for the second newbie question, I'm a developer not a sysadmin so this
Sorry for this curiosity that I have. sha1 use [a-f0-9] chars for its hashing
Sorry if the question is bit confusing. This is similar to this question I
Sorry for the confusing title of the question. I am uncertain about how should

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.