>>>> 2011/05/06 10:00 +0200, Rocio Gomez Escribano >>>> Tables "client" an "user" are quite similar, but they don't have any intersection, I mean, if somebody is a client, he or she cant be a user. So, I have his or her driving license and I need to know what kind of person is. <<<<<<<< Two others already have said it, that a union seems the real solution, and here is another variation:
SELECT 'user' AS kind, userID AS ID, userName AS Name, userCodeDrivingLicense AS DrivingLicense FROM user UNION SELECT 'client' AS kind, client.* FROM client It is also good to make a view out of it (or the other schemes, if they better suit). Then from the view, call it "uc", one does SELECT * FROM uc WHERE DrivingLicense = 321321321 and, whichever the scheme, sees by the outcome which table matched. But if, as already said, the tables "client" and "user" are made one, with a distinguishing field, there is one distinct advantage, that if "DrivingLicense" is made unique the notion that noöne is both user and client is enforced. With two separate tables there is nothing to keep someone from entering the same "DrivingLicense" in both tables. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org