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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:28:10+00:00 2026-05-24T09:28:10+00:00

I have 3 tables in a MySql Database: User; Company that has a date

  • 0

I have 3 tables in a MySql Database:

  1. User;
  2. Company that has a date field called data;
  3. Object that has idUser and idCompany.

I have to retrieve Companies that has got a specific date in date field of Company, and that meet the following rule:
There should be no records in Object table that has idP=xx and idI=(an id of a company that has got the specific value date yy-mm-dd)

How can I write this query?

  • 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-24T09:28:12+00:00Added an answer on May 24, 2026 at 9:28 am
    SELECT * FROM Company WHERE data = '2011-08-09' AND
    Company.id NOT IN
    (SELECT Object.idI FROM Object WHERE Object.idI = Company.id AND Object.idP = 'XX')
    

    But I have to say that your columns and tables naming need to be re-done. It could be a lot more meaningful.

    You have to created indexes for Object.idI and Object.idP to make it run quicker.

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

Sidebar

Related Questions

I have a MySQL database that has a few very simple tables. I would
I have a database that has 4 tables. Table 1 - company table with
I have 5 tables in my Mysql database with t1 with field name like
I have a database that has two tables, one of which contains a foreign
I have a directory table in a MySQL database that contains user ID's, user
I have 3 tables in a MySQL database. Table 1 (say it's called client
I have three tables set up in a MySQL database called event, status and
I have two tables in my MySQL database, one is a library of all
I have multiple tables in a MySQL database. Lets say they look like this:
I have three tables in a Mysql database - countries, cities and hotels. Their

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.