Ajay Patel - SunService wrote:

>I am a beginner at SQL and would appreciate any help with a simple
>query.
>
>I have two tables:
>
>host
>patch
>
>The host table contains details for a particular host (OS, cpus, memory, etc)
>and the patch table contains patches installed on that host.
>
>For example:
>
>Host:
>
>hostid                 hostname        OS      cpus    memory
>8000abcd       abacus          2.6     4       1024
>8001abce       quark           2.8     1       512
>8008efd1       sharp           2.9     2       2048
>
>Patch:
>
>hostid         patchnumber     patchversion
>8000abcd       105181          31
>8000abcd       109201          01
>8000abcd       108701          15
>
>8001abce       108528          12
>8001abce       108655          10
>8001abce       106655          07
>.
>.
>.
>
>I am trying to write a query that would list all hosts that
>do not have a particular patch installed.
>
>TIA,
>Ajay
>
SELECT patch.hostid
FROM patch left join host
ON patch.hostid=host.hostid
WHERE patchnumber=109201 and host.hostid is NULL;



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