I have 3 tables in a MySql Database:
- User;
- Company that has a date field called data;
- 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?
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.