Hi,

I have two tables that i want to link via an outer join:

mysql> desc active_monitors;
+----------------+----------+------+-----+---------+-------+
| Field          | Type     | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+-------+
| monitor_id     | int(7)   |      | PRI | 0       |       |
| endpoint       | char(16) |      | PRI |         |       |
| monitor        | char(75) | YES  |     | NULL    |       |
| last_value     | char(10) | YES  |     | NULL    |       |
| last_update    | datetime | YES  |     | NULL    |       |
| sentry_profile | char(80) |      | PRI |         |       |
| status         | char(10) | YES  |     | NULL    |       |
+----------------+----------+------+-----+---------+-------+

and 

mysql> desc endpoints_defined_monitors;
+----------------+----------+------+-----+---------+-------+
| Field          | Type     | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+-------+
| monitor_id     | int(7)   |      | PRI | 0       |       |
| monitor        | char(75) | YES  |     | NULL    |       |
| endpoint       | char(16) |      | PRI |         |       |
| sentry_profile | char(80) |      | PRI |         |       |
+----------------+----------+------+-----+---------+-------+


i link these tables with the following sql statement:

select D.monitor, D.endpoint, A.monitor from endpoints_defined_monitors D,
active_monitors A where A.monitor_id = D.monitor_ID and A.endpoint =
D.endpoint and A.sentry_profile = D.sentry_profile 

however, in some cases, there is a record in endpoints_defined_monitors that
doesn't exist in active_monitors, or maybe even the other way round.

Can someone tell me how I can adapt my sql statement so that I also get
these records (with the field 'monitor' having a NULL value ?).

Thanks,

Tom.


Tom Van Overbeke
Atos Origin 
Managed Services
Unix/WAN/Tivoli
Minervastraat 7
B-1930 Zaventem
Tel.   : +32 (2) 712 2650
Fax    : +32 (2) 712 2622
E-mail : [EMAIL PROTECTED]




---------------------------------------------------------------------
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

Reply via email to