0

I have check the other post about this but nothing seems to work for me. I have a MySQL database called cmd table called insta, with two col named vid ( int(11) and url (TEXT). What I want to do is find any duplicate url and display both the vid and the url. I have tried.


SELECT vid, url FROM insta
GROUP BY vid, url
HAVING COUNT(*) > 1

Even though them seems to work for other people it's not working for me. Can anyone tell me what I'm doing wrong

User
  • 1
  • 5

1 Answers1

0
select
    a.vid as vid1,
    b.vid as vid2,
    a.url
from
    insta a
inner join
    insta b
on
    a.url = b.url
where
    a.vid <> b.vid
Aitch
  • 1,617
  • 13
  • 24
  • I got this error Parse error: syntax error, unexpected 'a' (T_STRING) for the 2nd line of code. @Aitch – User Feb 07 '15 at 23:13
  • your error message (...T_STRING...) is a PHP error right? I wrote a SQL query. – Aitch Feb 07 '15 at 23:16
  • Yes, I copyed your code in to a php file and put in like this b.vid ?> @Aitch – User Feb 07 '15 at 23:21
  • 1
    oh man sorry, I will not tell you how to connect to the database and make a query. copy my query into phpmyadmin and check it out. – Aitch Feb 07 '15 at 23:26
  • I was able to use your code from phpmyadmin. Do you know how to get this to work from a php file. i would like it echo out the duplicats @aitch – User Feb 07 '15 at 23:28
  • http://php.net/manual/de/function.mysql-connect.php http://php.net/manual/de/function.mysql-query.php you can do it. – Aitch Feb 07 '15 at 23:39