Surprisingly enough I couldn't find this question, so I come here asking for help.
I have a mysql table:
+---------+------------+---------+
| id | link | col3 |
+---------+------------+---------+
| 1 | site.com | a |
+---------+------------+---------+
| 2 | site.com | b |
+---------+------------+---------+
| 3 | test.com | |
+---------+------------+---------+
I'm trying select all the rows which have the link column different. for example rows with id 1 and 3 would return but not 2 because it's already in 1 (link).
and note: col3 always has a different value, and I sometimes link is empty.
I've tried doing:
SELECT DISTINCT link, id FROM table WHERE col3 = '$col_id' AND link IS NOT NULL