Hi Christian, > i'm working on a project for managing used motorcycles. for security reasons > i setup two identical tables. both with the same attributes. > ID,UNIID,Manufacurer... one of the tables is named "Com" and the other > "Prv". > > till now i used to search either "Com" or "Prv". but i want to look for a > match in both of them and listing the result. i have tried anything i knew, > but without luck. > > please can anyone tell me, how the SQL Statment must look like to get such > an output? > > ------------------------------------- > Com > ------------------------------------- > ID | UNIID | Manufacturer | > ------------------------------------- > 1 | 12D2 | Yamaha | > 2 | 21E3 | test | > > ------------------------------------- > Prv > ------------------------------------- > ID | UNIID | Manufacturer | > ------------------------------------- > 1 | 43I2 | Kawasaki | > 2 | 68U2 | Something | > > > ------------------------------------- > output ???? > ------------------------------------- > ID | UNIID | Manufacturer | > ------------------------------------- > 1 | 43I2 | Kawasaki | > 2 | 68U2 | Something | > 1 | 12D2 | Yamaha | > 2 | 21E3 | test | > > > (Data of ID's equals, UNIID's are different, Manufacturer's are different.)
Check out the SELECT ... UNION ... SELECT... possibility at 6.4.1.2 UNION Syntax. Alternatively because the tables follow an identical schema, or if you have an older version of MySQL take a look at 7.2 MERGE Tables. Regards, =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php