0

how I want to view data. I tried that code but it not work. There are 2 database which are db1 and db2. table db1 are data_borang_mohon, and the key is no_kp_ejen table db2 are mohon, and the key is nokp_agen.I want to view all data that have same value no_kp_ejen=nokp_agen. example value is 123

db1 table name: data_borang_mohon

+------------------+--------------+
| no_kp_ejen       | Number       |
+------------------+--------------+
| 123              | 555-0071     |
| batmanbegins     | 555-0392     |
+------------------+--------------+

table name: mohon

+------------------+--------------+
| nokp_agen       | PhoneNumber  |
+------------------+--------------+
| 123              | 555-0074     |
| batmanbegins     | 555-0392     |
+------------------+--------------+

the view should be

+------------------+--------------+
| no_kp_ejen       | PhoneNumber  |
+------------------+--------------+
| 123              | 555-0074     |
| 123              | 555-0071     |
+------------------+--------------+
user3487681
  • 149
  • 1
  • 1
  • 9
  • 1
    Can you show us the table structure for the two tables. – Latheesan Apr 03 '14 at 07:39
  • It depends on what database you are running. In oracle for example, you could create, then use a DB Link. MySQL, not so much. If they are two completely different databases, you might be up the creek without a paddle here. – Fluffeh Apr 03 '14 at 07:44
  • So, you want to view data from two separate tables in two different databases based on some condition, is it so? – Choudhury Saadmaan Mahmid Apr 03 '14 at 07:57
  • yes.. view data from two separate tables in two different databases based on some condition – user3487681 Apr 03 '14 at 08:02
  • I deleted my answer since you are trying to join tables from 2 different databases. This is fairly complex in nature and needs proper permission before doing the query execution. you can check here http://stackoverflow.com/questions/5698378/mysql-join-between-tables-in-2-different-databases http://stackoverflow.com/questions/12685193/how-to-left-join-2-tables-on-2-different-databases – Abhik Chakraborty Apr 03 '14 at 08:14

0 Answers0