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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:31:46+00:00 2026-05-26T22:31:46+00:00

TABLE A id=1 +file_id=100 | | TABLE B |id=1 +file_id=100 | |TABLE FILES >id=100

  • 0
 TABLE A
 id=1
+file_id=100
|
| TABLE B
|id=1
+file_id=100
|
|TABLE FILES
>id=100
 file_name = picture.jpg
 file_size = 99999

file_id of TABLE A and TABLE B are in connection width TABLE FILES id.

I would like to check if any of the two table records are pointed to the file with let sey id=100. If not the file would be deleted.

How can I do this?

  • 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-26T22:31:46+00:00Added an answer on May 26, 2026 at 10:31 pm

    Delete the results of the query:

    SELECT filename 
    FROM files f
    WHERE (
         NOT EXISTS (SELECT * FROM A WHERE file_id= f.id) 
         AND NOT EXISTS (SELECT * FROM B WHERE file_id = f.id)
    )
    

    This (ideally) gets the files which are not referenced in either A or B

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

Sidebar

Related Questions

I'd like to save data from an SQL Server database table to a file,
Say I have a database table like the following: FileID | FileName | FileSize
I have a table representing values of source file metrics across project revisions, like
Say I got an traditional SQL structure like so: create table tags (id PRIMARY
I have a MySQL table defined: File -------------------------- ID int(11) PK name varchar(100) customerId
I have a table with 2.4M+ rows, and no indexes. I am 100% sure
I would like to change database column names of a BDC list webpart using
I have a relational database with about 100 tables. Each table has unique, numerical,
My (simplified) table consist of an Id int identity(1,1), File varchar(20), FileProcessed bit The
I've a table [File] that has the following schema CREATE TABLE [dbo].[File] ( [FileID]

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.