Question: I have a link on the page that opens a contact form in a modal window. 

How can I verify that the user clicked on the link to access the contact form, and did not go to the page directly. I don't want users or bots inadvertently browsing to that page.

Thanks in advance!

Answer: 
You need a way to distinguish the rows. Based on your comment, you could use the special [rowid column](http://www.sqlite.org/autoinc.html) for that.

To delete duplicates by keeping the lowest `rowid` per `(hash,d)`:

```
delete   from YourTable
where    rowid not in
         (
         select  min(rowid)
         from    YourTable
         group by
                 hash
         ,       d
         )

```
I guess the fastest would be to use the very database for it: add a new table with the same columns, but with proper constraints (a unique index on hash/real pair?), iterate through the original table and try to insert records in the new table, ignoring constraint violation errors (i.e. continue iterating when exceptions are raised).

Then delete the old table and rename the new to the old one.