Conditional one to many queries in mysql I have a simple patients table and lots of Lab tests table. Every patient can have many Lab tests. What i want to do is to only  query the tests which are already entered for that specific patient and avoid joining all 100000 tables(which will take lots of resources to execute).

Should i create a table and save which tests are conducted for the patient for later use?

PS: i have to mention that currently im using MYSQL and Doctrine 2(which is an ORM)and I'm out of options for using non-mysql solutions and i know that there are many Electronic medical records softwares using SQL but they are not opensource so we cant study them.
As Nick Chammas pointed out in his comment, your test tables should be combined if they have the same fields and segregated if they have very different fields.  

It is difficult to imagine 100,000 different test tables.  If this is not complete hyperbole then you might need to consider other options.

One option would be a document-oriented database.  This would be efficient for storage of loosely structured data and easy retrieval of data for a particular patient.  It would be pretty useless for rapid retrieval of data for similar tests across multiple patients.

Another option would be Entity-Attribute-Value (EAV).  EAV is considered an anti-pattern by most people, but yours may be a situation where it could be useful.  EAV would be less efficient at retrieving the results of a particular test for a particular patient, but it would certainly be better at getting all results for a particular patient than joining thousands of different test tables.  It would also be better than other approaches for getting the same test result values across multiple patients.