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
         )

```
If adding a primary key is not an option, then one approach would be to store the duplicates DISTINCT in a temp table, delete all of the duplicated records from the existing table, and then add the records back into the original table from the temp table.

For example (written for SQL Server 2008, but the technique is the same for any database):

```
DECLARE @original AS TABLE([hash] varchar(20), [d] float)
INSERT INTO @original VALUES('A', 1)
INSERT INTO @original VALUES('A', 2)
INSERT INTO @original VALUES('A', 1)
INSERT INTO @original VALUES('B', 1)
INSERT INTO @original VALUES('C', 1)
INSERT INTO @original VALUES('C', 1)

DECLARE @temp AS TABLE([hash] varchar(20), [d] float)
INSERT INTO @temp
SELECT [hash], [d] FROM @original 
GROUP BY [hash], [d]
HAVING COUNT(*) > 1

DELETE O
FROM @original O
JOIN @temp T ON T.[hash] = O.[hash] AND T.[d] = O.[d]

INSERT INTO @original
SELECT [hash], [d] FROM @temp

SELECT * FROM @original

```

I'm not sure if sqlite has a `ROW_NUMBER()` type function, but if it does you could also try some of the approaches listed here: [Delete duplicate records from a SQL table without a primary key](https://stackoverflow.com/questions/985384/delete-duplicate-records-from-a-sql-table-without-a-primary-key)