TableA
Id | M | D | Y |
=======================
1 | 10 | 28 | 2012 |
2 | 11 | 29 | 2012 |
3 | 12 | 30 | 2012 |
TableB
Id | M | D | Y |
=======================
4 | 09 | 28 | 2012 |
5 | 11 | 29 | 2012 |
6 | 01 | 30 | 2013 |
I will search by M and D
Ex: If matching M = 11 AND D = 29 … so will return ID(s) 2 , 5
I can only find by one table like this
mysql_query("SELECT * FROM TableA WHERE M='11' AND Y='29' ORDER BY D ASC , Id DESC;";)
But how to find in multiple tables ?
You better use
UNION ALL(in casetableBhas identical records) to get all the records. Otherwise justUNIONwill do.