Question: I want to parse an html page using org.w3c.dom package. Let it be <http://www.qypedeals.de/>. The page has a counter updated by JS So if I try to get a value of 

```
    <div class='counter_field' id='counter_day'>  

```

I always get 0. Is there any possibility to get that value?

Thanks in advance!

Answer: 
```
SELECT a.* from table_a a
LEFT JOIN table_b b ON (a.id = b.id)
WHERE b.id IS NULL        

```

You can also use `NOT EXISTS` (I believe it might have a bit worse performance in mysql though) :

```
SELECT a.* from table_a a 
WHERE NOT EXISTS (SELECT 1 FROM table_b b WHERE b.id = a.id)

```
Derived tables:

```
SELECT  *
FROM    (
        SELECT  id
        FROM    table_b
        ) b
JOIN    table_a a
ON      a.id = b.id

```

have nothing to do with `IN` predicates:

```
SELECT  *
FROM    table_a
WHERE   id NOT IN
        (
        SELECT  id
        FROM    table_b
        )

```

The subquery in the `IN` predicate is never materialized.

This way is actually the most efficient if you have an index on `table_b.id`.

Here are two more:

```
SELECT  *
FROM    table_a a
WHERE   NOT EXISTS
        (
        SELECT  NULL 
        FROM    table_b b
        WHERE   b.id = a.id
        )

```

and 

```
SELECT  *
FROM    table_a a
LEFT JOIN
        table_b b
ON      b.id = a.id
WHERE   b.id IS NULL

```

This query may also be efficient if `table_b.id` cannot be indexed (say, it's a derived expression) and `table_a.id` is `UNIQUE`:

```
SELECT  a.*
FROM    (
        SELECT  id, 1 AS s
        FROM    table_a
        UNION
        SELECT  id, -1 AS s
        FROM    table_b
        ) q
JOIN    table_a a
ON      a.id = q.id
GROUP BY
        a.id
HAVING  MAX(s) = 1

```

You may want to read this article:

* [**NOT IN vs. NOT EXISTS vs. LEFT JOIN / IS NULL: MySQL**](http://explainextended.com/2009/09/18/not-in-vs-not-exists-vs-left-join-is-null-mysql/)